From dce7891331fcf3b86095b64bea8853942dfd667c Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 2 Feb 2020 03:43:18 -0500 Subject: [PATCH] Add extremely basid handlePrivmsg --- handle.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/handle.c b/handle.c index ef61129..da635b4 100644 --- a/handle.c +++ b/handle.c @@ -193,6 +193,18 @@ static void handleJoin(struct Message *msg) { ); } +static void handlePrivmsg(struct Message *msg) { + require(msg, true, 2); + bool query = self.nick && !strcmp(msg->params[0], self.nick); + size_t id = idFor(query ? msg->nick : msg->params[0]); + if (query) idColors[id] = hash(msg->user); + uiFormat( + id, Warm, tagTime(msg), + "\3%d<%s>\3 %s", + hash(msg->user), msg->nick, msg->params[1] + ); +} + static void handlePing(struct Message *msg) { require(msg, false, 1); ircFormat("PONG :%s\r\n", msg->params[0]); @@ -215,6 +227,7 @@ static const struct Handler { { "CAP", handleCap }, { "JOIN", handleJoin }, { "PING", handlePing }, + { "PRIVMSG", handlePrivmsg }, }; static int compar(const void *cmd, const void *_handler) {