1
0
Fork 0
forked from murx/irc9

Remove channels from the tree after leaving

This commit is contained in:
Johannes Findeisen 2026-11-27 20:38:00 +01:00
commit 61822435f4
2 changed files with 9 additions and 3 deletions

View file

@ -128,7 +128,7 @@ instead.
| --- | --- |
| `/join #chan` | join a channel |
| `/n [chan]` / `/names [chan]` | show a channel's nicklist (default: current window) |
| `/part [#chan] [reason]` / `/leave [#chan] [reason]` | leave the current or given channel |
| `/part [#chan] [reason]` / `/leave [#chan] [reason]` | leave the current or given channel and remove it from the tree |
| `/nick newnick` | change nickname |
| `/msg nick text` | send a private message |
| `/notice target text` | send a notice |

10
irc9.c
View file

@ -1147,10 +1147,16 @@ static void handle_line(Server *s, char *line)
if (strcasecmp(cmd, "PART") == 0) {
if (narg < 1) return;
Window *w = window_get(s, arg[0], W_CHANNEL);
member_remove(w, nick);
char why[MAXLINE];
if (narg > 1) snprintf(why, sizeof why, " (%s)", arg[1]); else why[0] = 0;
Window *w;
if (strcasecmp(nick, s->nick) == 0) {
window_close(s, window_find(s, arg[0]));
w = sw;
} else {
w = window_get(s, arg[0], W_CHANNEL);
member_remove(w, nick);
}
appendf(w, "* %s left %s%s", hostmask ? hostmask : "someone", arg[0], why);
return;
}