From 410990c63d280320b9b1b5515433522711d468e0 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Sun, 29 Nov 2026 05:02:46 +0100 Subject: [PATCH] Suppress nickname-change notices in silent mode --- README.md | 3 ++- irc9.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 14ce077..232a363 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/irc9.c b/irc9.c index b2c405e..d6910b6 100644 --- a/irc9.c +++ b/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; }