summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-22 11:40:58 -0400
committerJune McEnroe <june@causal.agency>2020-03-22 11:40:58 -0400
commit0d0a6d15757f02eaee879e4f7f1bb3c24dab8f1d (patch)
treefd35f5e36fd6898e93a317723f41cf138053e5ca
parentHandle user mode changes (diff)
downloadcatgirl-0d0a6d15757f02eaee879e4f7f1bb3c24dab8f1d.tar.gz
catgirl-0d0a6d15757f02eaee879e4f7f1bb3c24dab8f1d.zip
Handle RPL_CHANNELMODEIS
Diffstat (limited to '')
-rw-r--r--handle.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/handle.c b/handle.c
index 4392094..fa3f36b 100644
--- a/handle.c
+++ b/handle.c
@@ -512,13 +512,13 @@ static void handleReplyUserModeIs(struct Message *msg) {
 		if (UserModes[(byte)*ch]) {
 			catf(buf, sizeof(buf), ", %s", UserModes[(byte)*ch]);
 		} else {
-			catf(buf, sizeof(buf), ", mode %c", *ch);
+			catf(buf, sizeof(buf), ", +%c", *ch);
 		}
 	}
 	uiFormat(
 		Network, Warm, tagTime(msg),
-		"\3%02d%s\3\tis%s",
-		self.color, self.nick, (buf[0] ? &buf[1] : buf)
+		"\3%02d%s\3\tis %s",
+		self.color, self.nick, (buf[0] ? &buf[2] : buf)
 	);
 }
 
@@ -537,6 +537,35 @@ static const char *ChanModes[256] = {
 	['v'] = "voice",
 };
 
+static void handleReplyChannelModeIs(struct Message *msg) {
+	require(msg, false, 3);
+	uint param = 3;
+	char buf[1024] = "";
+	for (char *ch = msg->params[2]; *ch; ++ch) {
+		if (*ch == '+') continue;
+		const char *name = ChanModes[(byte)*ch];
+		if (!name) name = (const char[]) { '+', *ch, '\0' };
+		if (
+			strchr(network.paramModes, *ch) ||
+			strchr(network.setParamModes, *ch)
+		) {
+			assert(param < ParamCap);
+			catf(
+				buf, sizeof(buf), ", has %s of %s",
+				name, msg->params[param++]
+			);
+		} else {
+			catf(buf, sizeof(buf), ", is %s", name);
+		}
+	}
+	uiFormat(
+		idFor(msg->params[1]), Cold, tagTime(msg),
+		"\3%02d%s\3\t%s",
+		hash(msg->params[1]), msg->params[1],
+		(buf[0] ? &buf[2] : "has no modes")
+	);
+}
+
 static void handleMode(struct Message *msg) {
 	require(msg, true, 2);
 
@@ -1017,6 +1046,7 @@ static const struct Handler {
 	{ "319", handleReplyWhoisChannels },
 	{ "322", handleReplyList },
 	{ "323", handleReplyListEnd },
+	{ "324", handleReplyChannelModeIs },
 	{ "330", handleReplyWhoisGeneric },
 	{ "331", handleReplyNoTopic },
 	{ "332", handleReplyTopic },
-02-12 02:23:15 -0500'>2020-02-12Move catgirl up the pageJune McEnroe 2020-02-12Update catgirl pty grabJune McEnroe 2020-02-12Link to cgit /about pages where appropriateJune McEnroe 2020-02-11Separate LINKS from BINS for html to workJune McEnroe 2020-02-11Add margin to Bl-bullet itemsJune McEnroe 2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe 2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe Apparently sometimes it didn't like receiving its own internal storage to parse again. Understandable. 2020-02-09Add To Be Taught, If FortunateJune McEnroe 2020-02-04Add The Future of Another TimelineJune McEnroe Wow. One of the best I've read. 2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe Broke out LDLIBS for each bin, and made everything more uniform. 2020-01-28Change scout sensitivity to 1.4June McEnroe idk it seems to work. 2020-01-28Import shows.txtJune McEnroe