nio

a simple irc client
Download | Log | Files | Refs | README

commit 455f46a72f9dd9b588aed0a72d138233ffe44da0
parent fc8dace4aea8aff10954440280f8157c97685ae0
Author: Andrew Kloet <andrew@kloet.net>
Date:   Sun, 29 Mar 2026 22:35:45 -0400

don't send JOIN for users

Diffstat:
Mnio.c | 18++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/nio.c b/nio.c @@ -578,31 +578,25 @@ uparse(char *m) switch (*p) { case 'j': /* Join channels. */ p += 1 + (p[1] == ' '); - p = strtok(p, " "); - while (p) { - if (chadd(p, 1) < 0) + for (char *token = strtok(p, " "); token; token = strtok(NULL, " ")) { + if (chadd(token, 1) < 0) break; - sndf("JOIN %s", p); - p = strtok(0, " "); + if (strchr("&#!+", token[0])) + sndf("JOIN %s", token); } tredraw(); return; case 'l': /* Leave channels. */ p += 1 + (p[1] == ' '); if (!*p) { - if (ch == 0) return; + if (ch == 0) return; /* Not in a channel */ static char buf[ChanLen]; strlcpy(buf, chl[ch].name, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; p = buf; } - char *token = strtok(p, " "); - while (token) { - char *next = strtok(NULL, " "); + for (char *token = strtok(p, " "); token; token = strtok(NULL, " ")) if (chdel(token) && strchr("&#!+", token[0])) sndf("PART %s", token); - token = next; - } tredraw(); return; case 'm': /* Private message. */