summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-01-04 19:53:48 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-01-04 19:53:48 +0100
commit8c49475f7576bd9eadb9816a9c725a2df99e85f6 (patch)
treee349b84f9a91ade01b9c46c22fb37deb80925230
parent08e0d3912ad37f9faf600ab9d2049792b236516e (diff)
downloadweechat-8c49475f7576bd9eadb9816a9c725a2df99e85f6.zip
irc: fix display of message 344 received as whois geo info (closes #1736)
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/plugins/irc/irc-protocol.c54
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp7
3 files changed, 40 insertions, 22 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 37e76cc70..e40c77949 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -27,6 +27,7 @@ New features::
Bug fixes::
* core: fix display of hotlist in buflist after changing value of option weechat.look.hotlist_sort (issue #1733)
+ * irc: fix display of message 344 received as whois geo info (issue #1736)
* irc: fix display of IRC numeric messages with no parameters
Tests::
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 2d8a5eb70..92396f353 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -3954,7 +3954,7 @@ IRC_PROTOCOL_CALLBACK(306)
* Callback for the whois commands with nick and message.
*
* Command looks like:
- * 319 flashy FlashCode :some text here
+ * 319 mynick nick :some text here
*/
IRC_PROTOCOL_CALLBACK(whois_nick_msg)
@@ -3989,7 +3989,7 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg)
* Callback for the whowas commands with nick and message.
*
* Command looks like:
- * 369 flashy FlashCode :some text here
+ * 369 mynick nick :some text here
*/
IRC_PROTOCOL_CALLBACK(whowas_nick_msg)
@@ -4945,10 +4945,13 @@ IRC_PROTOCOL_CALLBACK(341)
}
/*
- * Callback for the IRC command "344": channel reop.
+ * Callback for the IRC command "344": channel reop or whois geo info.
*
- * Command looks like:
+ * Command looks like, on IRCnet:
* 344 mynick #channel nick!user@host
+ *
+ * Command looks like, on UnrealIRCd:
+ * 344 mynick nick FR :is connecting from France
*/
IRC_PROTOCOL_CALLBACK(344)
@@ -4957,22 +4960,31 @@ IRC_PROTOCOL_CALLBACK(344)
IRC_PROTOCOL_MIN_PARAMS(3);
- str_host = irc_protocol_string_params (params, 2, num_params - 1);
-
- weechat_printf_date_tags (
- irc_msgbuffer_get_target_buffer (server, NULL, command, "reop", NULL),
- date,
- irc_protocol_tags (command, tags, "irc_numeric", NULL, NULL),
- _("%sChannel reop %s%s%s: %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- params[1],
- IRC_COLOR_RESET,
- IRC_COLOR_CHAT_HOST,
- str_host);
-
- if (str_host)
- free (str_host);
+ if (irc_channel_is_channel (server, params[1]))
+ {
+ /* channel reop (IRCnet) */
+ str_host = irc_protocol_string_params (params, 2, num_params - 1);
+ weechat_printf_date_tags (
+ irc_msgbuffer_get_target_buffer (server, NULL, command, "reop", NULL),
+ date,
+ irc_protocol_tags (command, tags, "irc_numeric", NULL, NULL),
+ _("%sChannel reop %s%s%s: %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ params[1],
+ IRC_COLOR_RESET,
+ IRC_COLOR_CHAT_HOST,
+ str_host);
+ if (str_host)
+ free (str_host);
+ }
+ else
+ {
+ /* whois, geo info (UnrealIRCd) */
+ irc_protocol_cb_whois_nick_msg (server, date, irc_message, tags, nick,
+ address, host, command, ignored,
+ params, num_params);
+ }
return WEECHAT_RC_OK;
}
@@ -7146,7 +7158,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
IRCB(338, 1, 0, 338), /* whois (host) */
IRCB(341, 1, 0, 341), /* inviting */
IRCB(343, 1, 0, 330_343), /* is opered as */
- IRCB(344, 1, 0, 344), /* channel reop */
+ IRCB(344, 1, 0, 344), /* channel reop / whois (geo info) */
IRCB(345, 1, 0, 345), /* end of channel reop list */
IRCB(346, 1, 0, 346), /* invite list */
IRCB(347, 1, 0, 347), /* end of invite list */
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index 66ee82d29..11d67200e 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -2976,16 +2976,21 @@ TEST(IrcProtocolWithServer, 344)
RECV(":server 344 alice #test");
CHECK_ERROR_PARAMS("344", 2, 3);
+ /* channel reop (IRCnet) */
RECV(":server 344 alice #test nick!user@host");
CHECK_SRV("-- Channel reop #test: nick!user@host");
RECV(":server 344 alice #test :nick!user@host");
CHECK_SRV("-- Channel reop #test: nick!user@host");
- /* channel not found */
+ /* channel reop (IRCnet), channel not found */
RECV(":server 344 alice #xyz nick!user@host");
CHECK_SRV("-- Channel reop #xyz: nick!user@host");
RECV(":server 344 alice #xyz :nick!user@host");
CHECK_SRV("-- Channel reop #xyz: nick!user@host");
+
+ /* whois, geo info (UnrealIRCd) */
+ RECV(":server 344 alice bob FR :is connecting from France");
+ CHECK_SRV("-- [bob] FR is connecting from France");
}
/*