From 1662b01a5f616bd4babc08e1eb6fec1a3c7b44cf Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 29 Dec 2020 23:49:16 -0500 Subject: Add /setname command I'm not sure about that replies check in handleStandardReply. If more of those are added the reply counter system will definitely need refactoring. --- handle.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'handle.c') diff --git a/handle.c b/handle.c index 96c99b7..d8f5f3d 100644 --- a/handle.c +++ b/handle.c @@ -97,6 +97,10 @@ 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( @@ -1150,6 +1154,17 @@ 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; @@ -1343,6 +1358,7 @@ static const struct Handler { { "PING", handlePing }, { "PRIVMSG", handlePrivmsg }, { "QUIT", handleQuit }, + { "SETNAME", handleSetname }, { "TOPIC", handleTopic }, { "WARN", handleStandardReply }, }; -- cgit 1.4.1