about summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-22 11:26:16 -0400
committerJune McEnroe <june@causal.agency>2020-03-22 11:26:16 -0400
commit61828a12e9651fb672331df400ebd4120673852a (patch)
tree2d20bc122f411acde9a094e0821d76c40792dcca /handle.c
parentRewrite handleMode (diff)
downloadcatgirl-61828a12e9651fb672331df400ebd4120673852a.tar.gz
catgirl-61828a12e9651fb672331df400ebd4120673852a.zip
Handle user mode changes
Diffstat (limited to 'handle.c')
-rw-r--r--handle.c19
1 files changed, 18 insertions, 1 deletions
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;
 	}
 
-pink/commit/ui-repolist.c?h=1.3.0&id=b60e6bff75719a5fb0df970bac3be6b2726cf73a&follow=1'>Convert pager navigation into a unordered listLukas Fleischer 2013-03-20Makefile: remove CGIT-CFLAGS files in clean stageJason A. Donenfeld 2013-03-20ui-summary.c: Move urls variable into print_urls()Lukas Fleischer 2013-03-20Fix colspan valuesLukas Fleischer 2013-03-20html: check return value of writeJason A. Donenfeld 2013-03-20ui-shared: squelch compiler warning.Jason A. Donenfeld 2013-03-20cgit.mk: Use SHELL_PATH_SQ to run gen-version.shJohn Keeping 2013-03-20cgit.mk: don't rebuild everything if CGIT_VERSION changesJohn Keeping 2013-03-20ui-patch: use cgit_version not CGIT_VERSIONJohn Keeping 2013-03-20Makefile: re-use Git's Makefile where possibleJohn Keeping