diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index b7727ebf4..d5f2ba2ac 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -4264,17 +4264,16 @@ IRC_PROTOCOL_CALLBACK(322) * Callback for the IRC command "323": end of /list. * * Command looks like: - * :server 323 mynick :End of /LIST + * 323 mynick :End of /LIST */ IRC_PROTOCOL_CALLBACK(323) { - char *pos_args; + char *str_params; - IRC_PROTOCOL_MIN_ARGS(3); + IRC_PROTOCOL_MIN_PARAMS(1); - pos_args = (argc > 3) ? - ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL; + str_params = irc_protocol_string_params (params, 1, num_params - 1); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, NULL, command, "list", NULL), @@ -4282,7 +4281,10 @@ IRC_PROTOCOL_CALLBACK(323) irc_protocol_tags (command, "irc_numeric", NULL, NULL), "%s%s", weechat_prefix ("network"), - (pos_args && pos_args[0]) ? pos_args : ""); + str_params); + + if (str_params) + free (str_params); return WEECHAT_RC_OK; } diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 58d316de1..e991ec958 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -2625,9 +2625,9 @@ TEST(IrcProtocolWithServer, 323) { SRV_INIT; - /* not enough arguments */ + /* not enough parameters */ RECV(":server 323"); - CHECK_ERROR_ARGS("323", 2, 3); + CHECK_ERROR_PARAMS("323", 0, 1); RECV(":server 323 alice"); CHECK_NO_MSG;