1
0
Fork 0
forked from murx/irc9

Suppress channel leave and sync notices in silent mode

This commit is contained in:
Johannes Findeisen 2026-11-29 03:38:27 +01:00
commit b38437544f
2 changed files with 6 additions and 6 deletions

View file

@ -12,10 +12,10 @@ around.
make make
./irc9 # finds a config automatically (see below) ./irc9 # finds a config automatically (see below)
./irc9 myconfig.conf # or point at a config explicitly ./irc9 myconfig.conf # or point at a config explicitly
./irc9 -s myconfig.conf # hide join and quit notices in channel windows ./irc9 -s myconfig.conf # hide channel activity notices
``` ```
`-s` and `--silent` hide JOIN and QUIT notices in channel windows. `-s` and `--silent` hide channel join, quit, leave, and sync 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.

8
irc9.c
View file

@ -1247,7 +1247,7 @@ static void handle_line(Server *s, char *line)
w = window_get(s, arg[0], W_CHANNEL); w = window_get(s, arg[0], W_CHANNEL);
member_remove(w, nick); member_remove(w, nick);
} }
append_nickf(w, "* ", hostmask ? hostmask : "someone", " ", "left %s%s", arg[0], why); if (!silent) append_nickf(w, "* ", hostmask ? hostmask : "someone", " ", "left %s%s", arg[0], why);
return; return;
} }
@ -1384,16 +1384,16 @@ static void handle_line(Server *s, char *line)
if (!w) w = window_get(s, arg[1], W_CHANNEL); if (!w) w = window_get(s, arg[1], W_CHANNEL);
if (w->type == W_CHANNEL) { if (w->type == W_CHANNEL) {
show_names(w); show_names(w);
if (w->syncing) { if (!silent && w->syncing) {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
double dt = (now.tv_sec - w->join_ts.tv_sec) + double dt = (now.tv_sec - w->join_ts.tv_sec) +
(now.tv_nsec - w->join_ts.tv_nsec) / 1e9; (now.tv_nsec - w->join_ts.tv_nsec) / 1e9;
appendf(w, "* synced %s in %.2fs", w->name, dt); appendf(w, "* synced %s in %.2fs", w->name, dt);
w->syncing = 0; } else if (!silent) {
} else {
appendf(w, "* synced %s", w->name); appendf(w, "* synced %s", w->name);
} }
w->syncing = 0;
} }
} }
return; return;