From a212a7ae2c93092068c8a9c483c4575cc65e7491 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Sun, 9 Feb 2020 00:53:55 -0500 Subject: Show realname on JOIN if it is different from nick --- catgirl.1 | 10 +++++++++- chat.h | 1 + handle.c | 11 +++++++++-- 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] ); } -- cgit 1.4.1-2-gfad0