diff options
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 13 | ||||
-rw-r--r-- | tests/unit/plugins/irc/test-irc-protocol.cpp | 10 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 7e22378b5..9ffa4362a 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -6857,22 +6857,27 @@ IRC_PROTOCOL_CALLBACK(900) * Callback for the IRC command "901": you are now logged in. * * Command looks like: - * :server 901 mynick nick user host :You are now logged in. (id nick, username user, hostname host) + * 901 mynick nick user host :You are now logged in. (id nick, username user, hostname host) */ IRC_PROTOCOL_CALLBACK(901) { - IRC_PROTOCOL_MIN_ARGS(6); + char *str_params; + + IRC_PROTOCOL_MIN_PARAMS(4); - if (argc >= 7) + if (num_params >= 5) { + str_params = irc_protocol_string_params (params, 4, num_params - 1); 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"), - (argv_eol[6][0] == ':') ? argv_eol[6] + 1 : argv_eol[6]); + str_params); + if (str_params) + free (str_params); } else { diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 71f0204ec..38dbd87a0 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -4030,15 +4030,15 @@ TEST(IrcProtocolWithServer, 901) { SRV_INIT; - /* not enough arguments */ + /* not enough parameters */ RECV(":server 901"); - CHECK_ERROR_ARGS("901", 2, 6); + CHECK_ERROR_PARAMS("901", 0, 4); RECV(":server 901 alice"); - CHECK_ERROR_ARGS("901", 3, 6); + CHECK_ERROR_PARAMS("901", 1, 4); RECV(":server 901 alice user"); - CHECK_ERROR_ARGS("901", 4, 6); + CHECK_ERROR_PARAMS("901", 2, 4); RECV(":server 901 alice user host"); - CHECK_ERROR_ARGS("901", 5, 6); + CHECK_ERROR_PARAMS("901", 3, 4); RECV(":server 901 alice nick user host logged"); CHECK_SRV("-- logged"); |