Permalink
Browse files

Cleanup tell_user functions (#631)

 Patch by: michaelortmann

    Delete unused parameters of tell_user()
    (master flag was not used and is not necessary because userent.c:comment_display() already checks for master flag to display COMMENT)
    Make tell_user() static
    Cleanup tell_user_ident() and tell_users_match()
  • Loading branch information...
michaelortmann authored and vanosg committed Oct 17, 2018
1 parent bb17ee0 commit a522bec4adee0def8a24faf75be02d9d33c6245b
Showing with 11 additions and 13 deletions.
  1. +2 −3 src/cmds.c
  2. +2 −2 src/proto.h
  3. +7 −8 src/users.c
View
@@ -521,7 +521,7 @@ static void cmd_whois(struct userrec *u, int idx, char *par)
}
putlog(LOG_CMDS, "*", "#%s# whois %s", dcc[idx].nick, par);
tell_user_ident(idx, par, u ? (u->flags & USER_MASTER) : 0);
tell_user_ident(idx, par);
}
static void cmd_match(struct userrec *u, int idx, char *par)
@@ -547,8 +547,7 @@ static void cmd_match(struct userrec *u, int idx, char *par)
} else
limit = atoi(s1);
}
tell_users_match(idx, s, start, limit, u ? (u->flags & USER_MASTER) : 0,
chname);
tell_users_match(idx, s, start, limit, chname);
}
static void cmd_uptime(struct userrec *u, int idx, char *par)
View
@@ -347,8 +347,8 @@ int match_ignore(char *);
void check_expired_ignores();
void autolink_cycle(char *);
void tell_file_stats(int, char *);
void tell_user_ident(int, char *, int);
void tell_users_match(int, char *, int, int, int, char *);
void tell_user_ident(int, char *);
void tell_users_match(int, char *, int, int, char *);
int readuserfile(char *, struct userrec **);
/* rfc1459.c */
View
@@ -453,7 +453,7 @@ static void restore_ignore(char *host)
putlog(LOG_MISC, "*", "*** Malformed ignore line.");
}
void tell_user(int idx, struct userrec *u, int master)
static void tell_user(int idx, struct userrec *u)
{
char s[81], s1[81], format[81];
int n = 0;
@@ -519,7 +519,7 @@ void tell_user(int idx, struct userrec *u, int master)
}
/* show user by ident */
void tell_user_ident(int idx, char *id, int master)
void tell_user_ident(int idx, char *id)
{
char format[81];
struct userrec *u;
@@ -534,14 +534,13 @@ void tell_user_ident(int idx, char *id, int master)
egg_snprintf(format, sizeof format,
"%%-%us PASS NOTES FLAGS LAST\n", HANDLEN);
dprintf(idx, format, "HANDLE");
tell_user(idx, u, master);
tell_user(idx, u);
}
/* match string:
* wildcard to match nickname or hostmasks
* +attr to find all with attr */
void tell_users_match(int idx, char *mtch, int start, int limit,
int master, char *chname)
void tell_users_match(int idx, char *mtch, int start, int limit, char *chname)
{
char format[81];
struct userrec *u;
@@ -582,7 +581,7 @@ void tell_users_match(int idx, char *mtch, int start, int limit,
if (nomns || !flagrec_eq(&mns, &user)) {
cnt++;
if ((cnt <= limit) && (cnt >= start)) {
tell_user(idx, u, master);
tell_user(idx, u);
}
if (cnt == limit + 1) {
dprintf(idx, MISC_TRUNCATED, limit);
@@ -592,7 +591,7 @@ void tell_users_match(int idx, char *mtch, int start, int limit,
} else if (wild_match(mtch, u->handle)) {
cnt++;
if ((cnt <= limit) && (cnt >= start)) {
tell_user(idx, u, master);
tell_user(idx, u);
}
if (cnt == limit + 1) {
dprintf(idx, MISC_TRUNCATED, limit);
@@ -604,7 +603,7 @@ void tell_users_match(int idx, char *mtch, int start, int limit,
cnt++;
fnd = 1;
if ((cnt <= limit) && (cnt >= start)) {
tell_user(idx, u, master);
tell_user(idx, u);
}
if (cnt == limit + 1) {
dprintf(idx, MISC_TRUNCATED, limit);

0 comments on commit a522bec

Please sign in to comment.