Suppress nickname-change notices in silent mode
This commit is contained in:
parent
76578805ba
commit
410990c63d
2 changed files with 7 additions and 5 deletions
|
|
@ -15,7 +15,8 @@ make
|
|||
./irc9 -s myconfig.conf # hide channel activity notices
|
||||
```
|
||||
|
||||
`-s` and `--silent` hide channel join, quit, leave, and sync notices.
|
||||
`-s` and `--silent` hide channel join, quit, leave, and sync notices, as well as
|
||||
nickname-change notices.
|
||||
`-C` and `--colored` color nicknames in channel and private chats and in
|
||||
nicklists. Your own nick is always green in this mode, including in the status
|
||||
line.
|
||||
|
|
|
|||
9
irc9.c
9
irc9.c
|
|
@ -1315,19 +1315,20 @@ static void handle_line(Server *s, char *line)
|
|||
|
||||
if (strcasecmp(cmd, "NICK") == 0) {
|
||||
if (narg < 1) return;
|
||||
int shown = 0;
|
||||
int in_channel = 0;
|
||||
for (Window *w = s->windows; w; w = w->next) {
|
||||
if (w->type == W_CHANNEL && member_find(w, nick)) {
|
||||
member_rename(w, nick, arg[0]);
|
||||
append_nickf(w, "* ", nick, " ", "is now known as %s", arg[0]);
|
||||
shown = 1;
|
||||
if (!silent) append_nickf(w, "* ", nick, " ", "is now known as %s", arg[0]);
|
||||
in_channel = 1;
|
||||
} else if (w->type == W_QUERY && strcasecmp(w->name, nick) == 0) {
|
||||
snprintf(w->name, sizeof w->name, "%s", arg[0]);
|
||||
}
|
||||
}
|
||||
if (strcasecmp(nick, s->nick) == 0)
|
||||
snprintf(s->nick, sizeof s->nick, "%s", arg[0]);
|
||||
if (!shown) appendf(sw, "* %s is now known as %s", nick, arg[0]);
|
||||
if (!silent && !in_channel) appendf(sw, "* %s is now known as %s", nick, arg[0]);
|
||||
dirty = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue