about summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-30 00:15:11 -0500
committerJune McEnroe <june@causal.agency>2020-12-30 00:19:52 -0500
commit05fbcb41c9a4d913677e91bf7414ef399374ed0f (patch)
treec47d5fe357ca0ea3172d3988fa0c88760696e287 /handle.c
parentAdd /setname command (diff)
downloadcatgirl-05fbcb41c9a4d913677e91bf7414ef399374ed0f.tar.gz
catgirl-05fbcb41c9a4d913677e91bf7414ef399374ed0f.zip
Show setnames like nick changes
Diffstat (limited to 'handle.c')
-rw-r--r--handle.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/handle.c b/handle.c
index d8f5f3d..b648840 100644
--- a/handle.c
+++ b/handle.c
@@ -97,10 +97,6 @@ typedef void Handler(struct Message *msg);
 
 static void handleStandardReply(struct Message *msg) {
 	require(msg, false, 3);
-	if (!strcmp(msg->params[0], "SETNAME")) {
-		if (!replies.setname) return;
-		replies.setname--;
-	}
 	for (uint i = 2; i < ParamCap - 1; ++i) {
 		if (msg->params[i + 1]) continue;
 		uiFormat(
@@ -446,6 +442,18 @@ static void handleNick(struct Message *msg) {
 	completeReplace(None, msg->nick, msg->params[0]);
 }
 
+static void handleSetname(struct Message *msg) {
+	require(msg, true, 1);
+	for (uint id; (id = completeID(msg->nick));) {
+		uiFormat(
+			id, ignoreCheck(Cold, id, msg), tagTime(msg),
+			"\3%02d%s\3\tis now known as \3%02d%s\3 (%s)",
+			hash(msg->user), msg->nick, hash(msg->user), msg->nick,
+			msg->params[0]
+		);
+	}
+}
+
 static void handleQuit(struct Message *msg) {
 	require(msg, true, 0);
 	for (uint id; (id = completeID(msg->nick));) {
@@ -1154,17 +1162,6 @@ static void handleReplyNowAway(struct Message *msg) {
 	replies.away--;
 }
 
-static void handleSetname(struct Message *msg) {
-	require(msg, true, 1);
-	if (!replies.setname) return;
-	if (strcmp(msg->nick, self.nick)) return;
-	uiFormat(
-		Network, Warm, tagTime(msg),
-		"You update your name tag: %s", msg->params[0]
-	);
-	replies.setname--;
-}
-
 static bool isAction(struct Message *msg) {
 	if (strncmp(msg->params[1], "\1ACTION ", 8)) return false;
 	msg->params[1] += 8;