]> jfr.im git - irc/irssi/irssi.git/commitdiff
Process the nick changes in queries before the PRIVMSG is handled.
authorLemonBoy <redacted>
Thu, 15 Dec 2016 14:22:30 +0000 (15:22 +0100)
committerLemonBoy <redacted>
Thu, 15 Dec 2016 18:36:44 +0000 (19:36 +0100)
Otherwise we end up with the message in the status window since the
frontend knows jack shit about the casemapping option when it tries to
find the associated window for the query.

src/fe-common/irc/fe-irc-queries.c
src/irc/core/irc-queries.c

index b2faefbcd1eea74c1ff26fa5ff354a059c5ffd91..c928a94ab38178561cf61f10a4d4ebdb91127361 100644 (file)
@@ -78,6 +78,13 @@ static void event_privmsg(SERVER_REC *server, const char *data,
                        if (!server_has_nick(server, query->name))
                                query_change_nick(query, nick);
                }
+       } else {
+               /* process the changes to the query structure now, before the
+                * privmsg is dispatched. */
+               if (g_strcmp0(query->name, nick) != 0)
+                       query_change_nick(query, nick);
+               if (address != NULL && g_strcmp0(query->address, address) != 0)
+                       query_change_address(query, address);
        }
 }
 
index 1286174468aeb43652028485daa397cb6cdbc828..b611e621cb1c412e5511223adef9284b2f0ffe3e 100644 (file)
@@ -79,20 +79,6 @@ static void check_query_changes(IRC_SERVER_REC *server, const char *nick,
        }
 }
 
-static void event_privmsg(IRC_SERVER_REC *server, const char *data,
-                         const char *nick, const char *address)
-{
-       char *params, *target, *msg;
-
-       g_return_if_fail(data != NULL);
-       if (nick == NULL)
-               return;
-
-       params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg);
-        check_query_changes(server, nick, address, target);
-       g_free(params);
-}
-
 static void ctcp_action(IRC_SERVER_REC *server, const char *msg,
                        const char *nick, const char *address,
                        const char *target)
@@ -117,14 +103,12 @@ static void event_nick(SERVER_REC *server, const char *data,
 
 void irc_queries_init(void)
 {
-       signal_add_last("event privmsg", (SIGNAL_FUNC) event_privmsg);
        signal_add_last("ctcp action", (SIGNAL_FUNC) ctcp_action);
        signal_add("event nick", (SIGNAL_FUNC) event_nick);
 }
 
 void irc_queries_deinit(void)
 {
-       signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg);
        signal_remove("ctcp action", (SIGNAL_FUNC) ctcp_action);
        signal_remove("event nick", (SIGNAL_FUNC) event_nick);
 }