about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--handle.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/handle.c b/handle.c
index 9a0be57..4cb0e94 100644
--- a/handle.c
+++ b/handle.c
@@ -488,6 +488,18 @@ static void handleTopic(struct Message *msg) {
 	}
 }
 
+static const char *ModeNames[256] = {
+	['i'] = "invite-only",
+	['k'] = "key",
+	['l'] = "client limit",
+	['m'] = "moderated",
+	['n'] = "no external messages",
+	['o'] = "operator",
+	['s'] = "secret",
+	['t'] = "protected topic",
+	['v'] = "voice",
+};
+
 static void handleMode(struct Message *msg) {
 	require(msg, true, 2);
 	if (!strchr(network.chanTypes, msg->params[0][0])) {
@@ -500,6 +512,8 @@ static void handleMode(struct Message *msg) {
 	uint param = 2;
 	char buf[1024] = "";
 	for (char *ch = msg->params[1]; *ch; ++ch) {
+		const char *name = ModeNames[(byte)*ch];
+		if (!name) name = (const char[]) { *ch, '\0' };
 		if (*ch == '+') {
 			set = true;
 		} else if (*ch == '-') {
@@ -541,11 +555,33 @@ static void handleMode(struct Message *msg) {
 			);
 
 		} else if (strchr(network.paramModes, *ch)) {
-			// TODO
+			assert(param < ParamCap);
+			catf(
+				buf, sizeof(buf), ", %ssets \3%02d%s\3 %s %s %s",
+				(set ? "" : "un"), hash(msg->params[0]), msg->params[0], name,
+				(set ? "to" : "from"), msg->params[param++]
+			);
+
 		} else if (strchr(network.setParamModes, *ch)) {
-			// TODO
+			if (set) {
+				assert(param < ParamCap);
+				catf(
+					buf, sizeof(buf), ", sets \3%02d%s\3 %s to %s",
+					hash(msg->params[0]), msg->params[0], name,
+					msg->params[param++]
+				);
+			} else {
+				catf(
+					buf, sizeof(buf), ", unsets \3%02d%s\3 %s",
+					hash(msg->params[0]), msg->params[0], name
+				);
+			}
+
 		} else {
-			// TODO
+			catf(
+				buf, sizeof(buf), ", %ssets \3%02d%s\3 %s",
+				(set ? "" : "un"), hash(msg->params[0]), msg->params[0], name
+			);
 		}
 	}
 	if (strlen(buf) < 2) return;
est/commit/ui.c?h=catgirl&id=4c4d91b4499d3a4bdc3850c4ad8a1713ce3a8e65&follow=1'>Rewrite UI againJune McEnroe 2018-09-12Add note about C-oJune McEnroe 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe