From 2b8a45779dcdb9f94060ddf694e99560ea80dabf Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 18 Sep 2020 18:13:09 -0400 Subject: Switch back to checking for server by nick with '.' This fixes a bug where if you send a private message before joining any channels, your message will be routed to the window. That happens because without a JOIN, self.user remains unset, which means that require will copy self.nick (set by echoMessage) to self.host. The easiest solution is to go back to checking for '.' and add a '.' to the default nick, so now if a server sends a NOTICE with no origin it will look like -*.*- which is kinda cute. --- handle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handle.c b/handle.c index e5e370e..cf3c977 100644 --- a/handle.c +++ b/handle.c @@ -76,7 +76,7 @@ static const char *capList(enum Cap caps) { static void require(struct Message *msg, bool origin, uint len) { if (origin) { - if (!msg->nick) msg->nick = "*"; + if (!msg->nick) msg->nick = "*.*"; if (!msg->user) msg->user = msg->nick; if (!msg->host) msg->host = msg->user; } @@ -1114,7 +1114,7 @@ static const char *colorMentions(uint id, struct Message *msg) { static void handlePrivmsg(struct Message *msg) { require(msg, true, 2); bool query = !strchr(network.chanTypes, msg->params[0][0]); - bool server = (msg->host == msg->nick); + bool server = strchr(msg->nick, '.'); bool mine = !strcmp(msg->nick, self.nick); uint id; if (query && server) { -- cgit 1.4.1