summary refs log tree commit diff
diff options
context:
space:
mode:
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 },
class='logmsg'> 2019-02-18Clean up htmlHeaderJune McEnroe 2019-02-18Remove hi line numberingJune McEnroe Tags are much better for referring to specific parts of a file and line numbering is better done by a post-processing tool such as cat -n or producing a two-column HTML <table>. 2019-02-18Add Tag class to hiJune McEnroe 2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe Running hi twice to insert stuff between the head and the content is a bit of a hack but oh well. 2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe 2019-02-17Simplify temp trap in upJune McEnroe 2019-02-17Add line numbers to hiJune McEnroe Renames previous -n option to -m to stay consistent with cat -n. Prefixing lines with line numbers affects where the first tab indent ends up relative to the text above it. Not sure if it's worth fixing somehow. 2019-02-17Always split spans after newlinesJune McEnroe Simplifies ANSI and IRC output code, and prepares for line numbered output. 2019-02-15Color format specifiers light cyan in vimJune McEnroe 2019-02-15Highlight Interp as yellowJune McEnroe 2019-02-15Highlight strings in sh command substitutionsJune McEnroe 2019-02-15Add nmap gpJune McEnroe 2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe 2019-02-13Add forgotten "sixth" book of H2G2June McEnroe