From 61828a12e9651fb672331df400ebd4120673852a Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Sun, 22 Mar 2020 11:26:16 -0400 Subject: Handle user mode changes --- handle.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/handle.c b/handle.c index b0f94d4..4392094 100644 --- a/handle.c +++ b/handle.c @@ -539,8 +539,25 @@ static const char *ChanModes[256] = { static void handleMode(struct Message *msg) { require(msg, true, 2); + if (!strchr(network.chanTypes, msg->params[0][0])) { - // TODO: User mode changes. + bool set = true; + char buf[1024] = ""; + for (char *ch = msg->params[1]; *ch; ++ch) { + if (*ch == '+') { set = true; continue; } + if (*ch == '-') { set = false; continue; } + const char *name = UserModes[(byte)*ch]; + if (!name) name = (const char[]) { "-+"[set], *ch, '\0' }; + catf( + buf, sizeof(buf), ", %ssets \3%02d%s\3 %s", + (set ? "" : "un"), self.color, msg->params[0], name + ); + } + if (!buf[0]) return; + uiFormat( + Network, Warm, tagTime(msg), + "\3%02d%s\3\t%s", hash(msg->user), msg->nick, &buf[2] + ); return; } -- cgit 1.4.1-2-gfad0