Handle so-called Standard Replies

weechat-hashes
C. McEnroe 2020-12-29 23:10:15 -05:00
parent df577c9cd4
commit b4ed58602b
2 changed files with 23 additions and 1 deletions

View File

@ -1,4 +1,4 @@
.Dd October 2, 2020 .Dd December 29, 2020
.Dt CATGIRL 1 .Dt CATGIRL 1
.Os .Os
. .
@ -743,6 +743,13 @@ ignore = * [JPQ][OAU][IR][NT] #example
.It .It
.Rs .Rs
.%A Daniel Oaks .%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 .%T IRC Formatting
.%I ircdocs .%I ircdocs
.%U https://modern.ircdocs.horse/formatting.html .%U https://modern.ircdocs.horse/formatting.html

View File

@ -95,6 +95,18 @@ static const time_t *tagTime(const struct Message *msg) {
typedef void Handler(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) { static void handleErrorGeneric(struct Message *msg) {
require(msg, false, 2); require(msg, false, 2);
if (msg->params[2]) { if (msg->params[2]) {
@ -1319,17 +1331,20 @@ static const struct Handler {
{ "CAP", handleCap }, { "CAP", handleCap },
{ "CHGHOST", handleChghost }, { "CHGHOST", handleChghost },
{ "ERROR", handleError }, { "ERROR", handleError },
{ "FAIL", handleStandardReply },
{ "INVITE", handleInvite }, { "INVITE", handleInvite },
{ "JOIN", handleJoin }, { "JOIN", handleJoin },
{ "KICK", handleKick }, { "KICK", handleKick },
{ "MODE", handleMode }, { "MODE", handleMode },
{ "NICK", handleNick }, { "NICK", handleNick },
{ "NOTE", handleStandardReply },
{ "NOTICE", handlePrivmsg }, { "NOTICE", handlePrivmsg },
{ "PART", handlePart }, { "PART", handlePart },
{ "PING", handlePing }, { "PING", handlePing },
{ "PRIVMSG", handlePrivmsg }, { "PRIVMSG", handlePrivmsg },
{ "QUIT", handleQuit }, { "QUIT", handleQuit },
{ "TOPIC", handleTopic }, { "TOPIC", handleTopic },
{ "WARN", handleStandardReply },
}; };
static int compar(const void *cmd, const void *_handler) { static int compar(const void *cmd, const void *_handler) {