summary refs log tree commit diff
diff options
context:
space:
mode:
authorC. McEnroe2020-02-09 00:53:55 -0500
committerC. McEnroe2020-02-09 00:55:41 -0500
commita212a7ae2c93092068c8a9c483c4575cc65e7491 (patch)
tree95a51bad8681774d8174707532f4763d039f0b12
parente0714a9b7e88bc2de9ec4b4c0d0a74dc3012b847 (diff)
Show realname on JOIN if it is different from nick
-rw-r--r--catgirl.110
-rw-r--r--chat.h1
-rw-r--r--handle.c11
3 files changed, 19 insertions, 3 deletions
diff --git a/catgirl.1 b/catgirl.1
index 4dabb4f..fd00105 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd February  8, 2020
+.Dd February  9, 2020
 .Dt CATGIRL 1
 .Os
 .
@@ -287,6 +287,14 @@ join = #ascii.town
 .Bl -item
 .It
 .Rs
+.%A Kiyoshi Aman
+.%T IRCv3.1 extended-join Extension
+.%I IRCv3 Working Group
+.%U https://ircv3.net/specs/extensions/extended-join-3.1
+.Re
+.
+.It
+.Rs
 .%A Waldo Bastian
 .%A Ryan Lortie
 .%A Lennart Poettering
diff --git a/chat.h b/chat.h
index 8bc8e81..896549e 100644
--- a/chat.h
+++ b/chat.h
@@ -59,6 +59,7 @@ static inline size_t idFor(const char *name) {
 }
 
 #define ENUM_CAP \
+	X("extended-join", CapExtendedJoin) \
 	X("sasl", CapSASL) \
 	X("server-time", CapServerTime) \
 	X("userhost-in-names", CapUserhostInNames)
diff --git a/handle.c b/handle.c
index cf0e853..0297595 100644
--- a/handle.c
+++ b/handle.c
@@ -214,10 +214,17 @@ static void handleJoin(struct Message *msg) {
 		uiShowID(id);
 	}
 	completeTouch(id, msg->nick, hash(msg->user));
+	if (msg->params[2] && !strcasecmp(msg->params[2], msg->nick)) {
+		msg->params[2] = NULL;
+	}
 	uiFormat(
 		id, Cold, tagTime(msg),
-		"\3%02d%s\3\tarrives in \3%02d%s\3",
-		hash(msg->user), msg->nick, hash(msg->params[0]), msg->params[0]
+		"\3%02d%s\3\t%s%s%sarrives in \3%02d%s\3",
+		hash(msg->user), msg->nick,
+		(msg->params[2] ? "(" : ""),
+		(msg->params[2] ? msg->params[2] : ""),
+		(msg->params[2] ? ") " : ""),
+		hash(msg->params[0]), msg->params[0]
 	);
 }