Add extremely basid handlePrivmsg

master
C. McEnroe 2020-02-02 03:43:18 -05:00
parent 052cd2ed26
commit dce7891331
1 changed files with 13 additions and 0 deletions

View File

@ -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) { static void handlePing(struct Message *msg) {
require(msg, false, 1); require(msg, false, 1);
ircFormat("PONG :%s\r\n", msg->params[0]); ircFormat("PONG :%s\r\n", msg->params[0]);
@ -215,6 +227,7 @@ static const struct Handler {
{ "CAP", handleCap }, { "CAP", handleCap },
{ "JOIN", handleJoin }, { "JOIN", handleJoin },
{ "PING", handlePing }, { "PING", handlePing },
{ "PRIVMSG", handlePrivmsg },
}; };
static int compar(const void *cmd, const void *_handler) { static int compar(const void *cmd, const void *_handler) {