summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-10-17 20:24:18 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-10-17 21:28:31 +0200
commitcde0d5f7a5ad4ad4883e5046e481c73f88e79381 (patch)
tree25c8a164d7ef18b02ba48e0d7e40534c155e6f50
parentba5b744397eb73cd0818f97c2fd084f271b6eb46 (diff)
downloadweechat-cde0d5f7a5ad4ad4883e5046e481c73f88e79381.zip
irc: do not display "*" when received as nick in command 900
-rw-r--r--src/plugins/irc/irc-protocol.c39
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp2
2 files changed, 30 insertions, 11 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 9266b96b1..43b06bd39 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -6823,27 +6823,44 @@ IRC_PROTOCOL_CALLBACK(734)
*
* Command looks like:
* 900 mynick nick!user@host mynick :You are now logged in as mynick
+ * 900 * * mynick :You are now logged in as mynick
*/
IRC_PROTOCOL_CALLBACK(900)
{
char *str_params;
+ const char *pos_nick_host;
IRC_PROTOCOL_MIN_PARAMS(4);
+ pos_nick_host = (strcmp (params[1], "*") != 0) ? params[1] : NULL;
+
str_params = irc_protocol_string_params (params, 3, num_params - 1);
- weechat_printf_date_tags (
- irc_msgbuffer_get_target_buffer (server, params[1], command, NULL, NULL),
- date,
- irc_protocol_tags (command, "irc_numeric", NULL, NULL),
- "%s%s %s(%s%s%s)",
- weechat_prefix ("network"),
- str_params,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT_HOST,
- params[1],
- IRC_COLOR_CHAT_DELIMITERS);
+ if (pos_nick_host)
+ {
+ weechat_printf_date_tags (
+ irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL),
+ date,
+ irc_protocol_tags (command, "irc_numeric", NULL, NULL),
+ "%s%s %s(%s%s%s)",
+ weechat_prefix ("network"),
+ str_params,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT_HOST,
+ pos_nick_host,
+ IRC_COLOR_CHAT_DELIMITERS);
+ }
+ else
+ {
+ weechat_printf_date_tags (
+ irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL),
+ date,
+ irc_protocol_tags (command, "irc_numeric", NULL, NULL),
+ "%s%s",
+ weechat_prefix ("network"),
+ str_params);
+ }
irc_server_free_sasl_data (server);
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index 963482ce2..9daa1d110 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -4014,6 +4014,8 @@ TEST(IrcProtocolWithServer, 900)
RECV(":server 900 alice alice!user@host alice "
":You are now logged in as mynick");
CHECK_SRV("-- You are now logged in as mynick (alice!user@host)");
+ RECV(":server 900 * * alice :You are now logged in as mynick");
+ CHECK_SRV("-- You are now logged in as mynick");
}
/*