1
0
Fork 0
forked from murx/irc9

Suppress nickname-change notices in silent mode

This commit is contained in:
Johannes Findeisen 2026-11-29 05:02:46 +01:00
commit 410990c63d
2 changed files with 7 additions and 5 deletions

View file

@ -15,7 +15,8 @@ make
./irc9 -s myconfig.conf # hide channel activity notices ./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 `-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 nicklists. Your own nick is always green in this mode, including in the status
line. line.

9
irc9.c
View file

@ -1315,19 +1315,20 @@ static void handle_line(Server *s, char *line)
if (strcasecmp(cmd, "NICK") == 0) { if (strcasecmp(cmd, "NICK") == 0) {
if (narg < 1) return; if (narg < 1) return;
int shown = 0; int in_channel = 0;
for (Window *w = s->windows; w; w = w->next) { for (Window *w = s->windows; w; w = w->next) {
if (w->type == W_CHANNEL && member_find(w, nick)) { if (w->type == W_CHANNEL && member_find(w, nick)) {
member_rename(w, nick, arg[0]); member_rename(w, nick, arg[0]);
append_nickf(w, "* ", nick, " ", "is now known as %s", arg[0]); if (!silent) append_nickf(w, "* ", nick, " ", "is now known as %s", arg[0]);
shown = 1; in_channel = 1;
} else if (w->type == W_QUERY && strcasecmp(w->name, nick) == 0) { } else if (w->type == W_QUERY && strcasecmp(w->name, nick) == 0) {
snprintf(w->name, sizeof w->name, "%s", arg[0]); snprintf(w->name, sizeof w->name, "%s", arg[0]);
} }
} }
if (strcasecmp(nick, s->nick) == 0) if (strcasecmp(nick, s->nick) == 0)
snprintf(s->nick, sizeof s->nick, "%s", arg[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; return;
} }