summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorC. McEnroe2020-02-14 21:36:58 -0500
committerC. McEnroe2020-02-14 21:36:58 -0500
commit39a343980b634f41377d72426ced50ca8ae0fb64 (patch)
treeaf29e7daa153c7427bfaffcf42ea71bec5b96241 /handle.c
parent8aa6dd86f6c7036f6dbc065efb63e1b75e5cf0a8 (diff)
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 },