summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorC. McEnroe2020-12-29 23:10:15 -0500
committerC. McEnroe2020-12-29 23:11:57 -0500
commitb4ed58602b87d8c3dfc949dfc438fad78c1d074a (patch)
treebe2706ff0e8b5de247f950654019cc0239d98be1 /handle.c
parentdf577c9cd40dce5b0b78d012ec15e1286649b5bc (diff)
Handle so-called Standard Replies
Diffstat (limited to 'handle.c')
-rw-r--r--handle.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index a8f9ede..96c99b7 100644
--- a/handle.c
+++ b/handle.c
@@ -95,6 +95,18 @@ static const time_t *tagTime(const struct Message *msg) {
 
 typedef void Handler(struct Message *msg);
 
+static void handleStandardReply(struct Message *msg) {
+	require(msg, false, 3);
+	for (uint i = 2; i < ParamCap - 1; ++i) {
+		if (msg->params[i + 1]) continue;
+		uiFormat(
+			Network, Warm, tagTime(msg),
+			"%s", msg->params[i]
+		);
+		break;
+	}
+}
+
 static void handleErrorGeneric(struct Message *msg) {
 	require(msg, false, 2);
 	if (msg->params[2]) {
@@ -1319,17 +1331,20 @@ static const struct Handler {
 	{ "CAP", handleCap },
 	{ "CHGHOST", handleChghost },
 	{ "ERROR", handleError },
+	{ "FAIL", handleStandardReply },
 	{ "INVITE", handleInvite },
 	{ "JOIN", handleJoin },
 	{ "KICK", handleKick },
 	{ "MODE", handleMode },
 	{ "NICK", handleNick },
+	{ "NOTE", handleStandardReply },
 	{ "NOTICE", handlePrivmsg },
 	{ "PART", handlePart },
 	{ "PING", handlePing },
 	{ "PRIVMSG", handlePrivmsg },
 	{ "QUIT", handleQuit },
 	{ "TOPIC", handleTopic },
+	{ "WARN", handleStandardReply },
 };
 
 static int compar(const void *cmd, const void *_handler) {