about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-20 03:18:48 -0500
committerJune McEnroe <june@causal.agency>2020-02-20 03:18:48 -0500
commitb3c5458fc99292064e210999ff44d29d50dd9f87 (patch)
treeaceb2107386cd1175b42390d10728f22858fabe2
parentHandle RPL_INVITING when no invite-notify (diff)
downloadcatgirl-b3c5458fc99292064e210999ff44d29d50dd9f87.tar.gz
catgirl-b3c5458fc99292064e210999ff44d29d50dd9f87.zip
Rearrange some handlers
-rw-r--r--handle.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/handle.c b/handle.c
index 6a81380..ed70ce8 100644
--- a/handle.c
+++ b/handle.c
@@ -367,20 +367,46 @@ static void handleQuit(struct Message *msg) {
 	completeRemove(None, msg->nick);
 }
 
-static void handleErrorUserNotInChannel(struct Message *msg) {
-	require(msg, false, 4);
-	uiFormat(
-		idFor(msg->params[2]), Cold, tagTime(msg),
-		"%s\tis not in \3%02d%s\3",
-		msg->params[1], hash(msg->params[2]), msg->params[2]
-	);
+static void handleInvite(struct Message *msg) {
+	require(msg, true, 2);
+	if (!strcmp(msg->params[0], self.nick)) {
+		uiFormat(
+			Network, Hot, tagTime(msg),
+			"\3%02d%s\3\tinvites you to \3%02d%s\3",
+			hash(msg->user), msg->nick, hash(msg->params[1]), msg->params[1]
+		);
+	} else {
+		uiFormat(
+			idFor(msg->params[1]), Cold, tagTime(msg),
+			"\3%02d%s\3\tinvites %s to \3%02d%s\3",
+			hash(msg->user), msg->nick,
+			msg->params[0],
+			hash(msg->params[1]), msg->params[1]
+		);
+	}
 }
 
-static void handleErrorBanListFull(struct Message *msg) {
+static void handleReplyInviting(struct Message *msg) {
+	require(msg, false, 3);
+	if (self.caps & CapInviteNotify) return;
+	struct Message invite = {
+		.nick = self.nick,
+		.user = self.user,
+		.cmd = "INVITE",
+		.params[0] = msg->params[1],
+		.params[1] = msg->params[2],
+	};
+	handleInvite(&invite);
+}
+
+static void handleErrorUserOnChannel(struct Message *msg) {
 	require(msg, false, 4);
+	uint id = idFor(msg->params[2]);
 	uiFormat(
-		idFor(msg->params[1]), Cold, tagTime(msg),
-		"%s", (msg->params[4] ? msg->params[4] : msg->params[3])
+		id, Cold, tagTime(msg),
+		"\3%02d%s\3 is already in \3%02d%s\3",
+		completeColor(id, msg->params[1]), msg->params[1],
+		hash(msg->params[2]), msg->params[2]
 	);
 }
 
@@ -458,6 +484,23 @@ static void handleTopic(struct Message *msg) {
 	}
 }
 
+static void handleErrorUserNotInChannel(struct Message *msg) {
+	require(msg, false, 4);
+	uiFormat(
+		idFor(msg->params[2]), Cold, tagTime(msg),
+		"%s\tis not in \3%02d%s\3",
+		msg->params[1], hash(msg->params[2]), msg->params[2]
+	);
+}
+
+static void handleErrorBanListFull(struct Message *msg) {
+	require(msg, false, 4);
+	uiFormat(
+		idFor(msg->params[1]), Cold, tagTime(msg),
+		"%s", (msg->params[4] ? msg->params[4] : msg->params[3])
+	);
+}
+
 static void handleReplyBanList(struct Message *msg) {
 	require(msg, false, 3);
 	if (!replies.ban) return;
@@ -487,49 +530,6 @@ static void handleReplyEndOfBanList(struct Message *msg) {
 	if (replies.ban) replies.ban--;
 }
 
-static void handleInvite(struct Message *msg) {
-	require(msg, true, 2);
-	if (!strcmp(msg->params[0], self.nick)) {
-		uiFormat(
-			Network, Hot, tagTime(msg),
-			"\3%02d%s\3\tinvites you to \3%02d%s\3",
-			hash(msg->user), msg->nick, hash(msg->params[1]), msg->params[1]
-		);
-	} else {
-		uiFormat(
-			idFor(msg->params[1]), Cold, tagTime(msg),
-			"\3%02d%s\3\tinvites %s to \3%02d%s\3",
-			hash(msg->user), msg->nick,
-			msg->params[0],
-			hash(msg->params[1]), msg->params[1]
-		);
-	}
-}
-
-static void handleReplyInviting(struct Message *msg) {
-	require(msg, false, 3);
-	if (self.caps & CapInviteNotify) return;
-	struct Message invite = {
-		.nick = self.nick,
-		.user = self.user,
-		.cmd = "INVITE",
-		.params[0] = msg->params[1],
-		.params[1] = msg->params[2],
-	};
-	handleInvite(&invite);
-}
-
-static void handleErrorUserOnChannel(struct Message *msg) {
-	require(msg, false, 4);
-	uint id = idFor(msg->params[2]);
-	uiFormat(
-		id, Cold, tagTime(msg),
-		"\3%02d%s\3 is already in \3%02d%s\3",
-		completeColor(id, msg->params[1]), msg->params[1],
-		hash(msg->params[2]), msg->params[2]
-	);
-}
-
 static void handleReplyList(struct Message *msg) {
 	require(msg, false, 4);
 	if (!replies.list) return;