From b4ed58602b87d8c3dfc949dfc438fad78c1d074a Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 29 Dec 2020 23:10:15 -0500 Subject: Handle so-called Standard Replies --- catgirl.1 | 9 ++++++++- handle.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/catgirl.1 b/catgirl.1 index fd21913..ae7fe52 100644 --- a/catgirl.1 +++ b/catgirl.1 @@ -1,4 +1,4 @@ -.Dd October 2, 2020 +.Dd December 29, 2020 .Dt CATGIRL 1 .Os . @@ -743,6 +743,13 @@ ignore = * [JPQ][OAU][IR][NT] #example .It .Rs .%A Daniel Oaks +.%T Standard Replies Extension +.%I IRCv3 Working Group +.%U https://ircv3.net/specs/extensions/standard-replies +.Re +.It +.Rs +.%A Daniel Oaks .%T IRC Formatting .%I ircdocs .%U https://modern.ircdocs.horse/formatting.html diff --git a/handle.c b/handle.c index a8f9ede..96c99b7 100644 --- a/handle.c +++ b/handle.c @@ -95,6 +95,18 @@ static const time_t *tagTime(const struct Message *msg) { typedef void Handler(struct Message *msg); +static void handleStandardReply(struct Message *msg) { + require(msg, false, 3); + for (uint i = 2; i < ParamCap - 1; ++i) { + if (msg->params[i + 1]) continue; + uiFormat( + Network, Warm, tagTime(msg), + "%s", msg->params[i] + ); + break; + } +} + static void handleErrorGeneric(struct Message *msg) { require(msg, false, 2); if (msg->params[2]) { @@ -1319,17 +1331,20 @@ static const struct Handler { { "CAP", handleCap }, { "CHGHOST", handleChghost }, { "ERROR", handleError }, + { "FAIL", handleStandardReply }, { "INVITE", handleInvite }, { "JOIN", handleJoin }, { "KICK", handleKick }, { "MODE", handleMode }, { "NICK", handleNick }, + { "NOTE", handleStandardReply }, { "NOTICE", handlePrivmsg }, { "PART", handlePart }, { "PING", handlePing }, { "PRIVMSG", handlePrivmsg }, { "QUIT", handleQuit }, { "TOPIC", handleTopic }, + { "WARN", handleStandardReply }, }; static int compar(const void *cmd, const void *_handler) { -- cgit 1.4.1