summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--handle.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index 4b15517..f374e36 100644
--- a/handle.c
+++ b/handle.c
@@ -496,6 +496,32 @@ static void handleTopic(struct Message *msg) {
 	}
 }
 
+static const char *UserModes[256] = {
+	['O'] = "local oper",
+	['i'] = "invisible",
+	['o'] = "oper",
+	['r'] = "registered",
+	['w'] = "wallops",
+};
+
+static void handleReplyUserModeIs(struct Message *msg) {
+	require(msg, false, 2);
+	char buf[1024] = "";
+	for (char *ch = msg->params[1]; *ch; ++ch) {
+		if (*ch == '+') continue;
+		if (UserModes[(byte)*ch]) {
+			catf(buf, sizeof(buf), ", %s", UserModes[(byte)*ch]);
+		} else {
+			catf(buf, sizeof(buf), ", mode %c", *ch);
+		}
+	}
+	uiFormat(
+		Network, Warm, tagTime(msg),
+		"\3%02d%s\3\tis%s",
+		self.color, self.nick, (buf[0] ? &buf[1] : buf)
+	);
+}
+
 static const char *ModeNames[256] = {
 	['i'] = "invite-only",
 	['k'] = "key",
@@ -960,6 +986,7 @@ static const struct Handler {
 } Handlers[] = {
 	{ "001", handleReplyWelcome },
 	{ "005", handleReplyISupport },
+	{ "221", handleReplyUserModeIs },
 	{ "276", handleReplyWhoisGeneric },
 	{ "301", handleReplyAway },
 	{ "305", handleReplyNowAway },
>2019-01-13Use colours in cash promptsJune McEnroe 2019-01-12Set PSlit like NetBSD shJune McEnroe 2019-01-12Install gnupg2 from pkgsrc and symlink gpgJune McEnroe 2019-01-12Reference cash builtin man pages in cash.1 SEE ALSOJune McEnroe 2019-01-12Restore cash builtin man page datesJune McEnroe 2019-01-12Use local libeditJune McEnroe 2019-01-12Replace libedit MakefileJune McEnroe 2019-01-11Import /usr/src/lib/libedit from NetBSD 8.0June McEnroe 2019-01-11Add PSlit for prompt escapesJune McEnroe 2019-01-11Don't make depend automaticallyJune McEnroe