about summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-08 00:01:59 -0500
committerJune McEnroe <june@causal.agency>2020-02-08 00:01:59 -0500
commit58e1d5b4e2fabead1aae356dd060bfc9748bdd5e (patch)
tree81ef7706e6ba1579bb90130bc92c60177adaf06f /handle.c
parentOnly treat the first tab as the alignment point (diff)
downloadcatgirl-58e1d5b4e2fabead1aae356dd060bfc9748bdd5e.tar.gz
catgirl-58e1d5b4e2fabead1aae356dd060bfc9748bdd5e.zip
Handle NICK
Diffstat (limited to 'handle.c')
-rw-r--r--handle.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index b73d200..fe64f33 100644
--- a/handle.c
+++ b/handle.c
@@ -261,6 +261,22 @@ static void handleTopic(struct Message *msg) {
 	}
 }
 
+static void handleNick(struct Message *msg) {
+	require(msg, true, 1);
+	if (self.nick && !strcmp(msg->nick, self.nick)) {
+		set(&self.nick, msg->params[0]);
+	}
+	size_t id;
+	completeReplace(None, msg->nick, msg->params[0]);
+	while (None != (id = completeID(msg->params[0]))) {
+		uiFormat(
+			id, Cold, tagTime(msg),
+			"\3%02d%s\3\tis now known as \3%02d%s\3",
+			hash(msg->user), msg->nick, hash(msg->user), msg->params[0]
+		);
+	}
+}
+
 static bool isAction(struct Message *msg) {
 	if (strncmp(msg->params[1], "\1ACTION ", 8)) return false;
 	msg->params[1] += 8;
@@ -354,6 +370,7 @@ static const struct Handler {
 	{ "CAP", handleCap },
 	{ "ERROR", handleError },
 	{ "JOIN", handleJoin },
+	{ "NICK", handleNick },
 	{ "NOTICE", handlePrivmsg },
 	{ "PART", handlePart },
 	{ "PING", handlePing },