summary refs log tree commit diff
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
parentAdd /setname command (diff)
downloadcatgirl-05fbcb41c9a4d913677e91bf7414ef399374ed0f.tar.gz
catgirl-05fbcb41c9a4d913677e91bf7414ef399374ed0f.zip
Show setnames like nick changes
Diffstat (limited to '')
-rw-r--r--catgirl.13
-rw-r--r--chat.h1
-rw-r--r--command.c1
-rw-r--r--handle.c27
4 files changed, 14 insertions, 18 deletions
diff --git a/catgirl.1 b/catgirl.1
index 09536da..3f65618 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -187,7 +187,8 @@ The commands which can be filtered are:
 .Sy NOTICE ,
 .Sy PART ,
 .Sy PRIVMSG ,
-.Sy QUIT .
+.Sy QUIT ,
+.Sy SETNAME .
 .
 .It Fl j Ar join , Cm join = Ar join
 Join the comma-separated list of channels
diff --git a/chat.h b/chat.h
index 82ffded..ccd8863 100644
--- a/chat.h
+++ b/chat.h
@@ -257,7 +257,6 @@ extern struct Replies {
 	uint list;
 	uint mode;
 	uint names;
-	uint setname;
 	uint topic;
 	uint who;
 	uint whois;
diff --git a/command.c b/command.c
index 199a561..bf5a2e3 100644
--- a/command.c
+++ b/command.c
@@ -163,7 +163,6 @@ static void commandSetname(uint id, char *params) {
 	(void)id;
 	if (!params) return;
 	ircFormat("SETNAME :%s\r\n", params);
-	replies.setname++;
 }
 
 static void commandTopic(uint id, char *params) {
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;