summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-14 21:36:58 -0500
committerJune McEnroe <june@causal.agency>2020-02-14 21:36:58 -0500
commit39a343980b634f41377d72426ced50ca8ae0fb64 (patch)
treeaf29e7daa153c7427bfaffcf42ea71bec5b96241 /handle.c
parentAdd /away (diff)
downloadcatgirl-39a343980b634f41377d72426ced50ca8ae0fb64.tar.gz
catgirl-39a343980b634f41377d72426ced50ca8ae0fb64.zip
Add /invite
Diffstat (limited to 'handle.c')
-rw-r--r--handle.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index 6dffa17..a73ae3e 100644
--- a/handle.c
+++ b/handle.c
@@ -418,6 +418,25 @@ static void handleTopic(struct Message *msg) {
 	}
 }
 
+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 handleReplyList(struct Message *msg) {
 	require(msg, false, 4);
 	if (!replies.list) return;
@@ -710,6 +729,7 @@ static const struct Handler {
 	{ "AUTHENTICATE", handleAuthenticate },
 	{ "CAP", handleCap },
 	{ "ERROR", handleError },
+	{ "INVITE", handleInvite },
 	{ "JOIN", handleJoin },
 	{ "KICK", handleKick },
 	{ "NICK", handleNick },