1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

irc: use parsed command parameters in "303" command callback

This commit is contained in:
Sébastien Helleu
2021-10-15 21:05:54 +02:00
parent 76b75ad5cd
commit efecdf5d45
2 changed files with 13 additions and 6 deletions
+10 -3
View File
@@ -3769,12 +3769,16 @@ IRC_PROTOCOL_CALLBACK(301)
* Callback for the IRC command "303": ison.
*
* Command looks like:
* :server 303 mynick :nick1 nick2
* 303 mynick :nick1 nick2
*/
IRC_PROTOCOL_CALLBACK(303)
{
IRC_PROTOCOL_MIN_ARGS(4);
char *str_params;
IRC_PROTOCOL_MIN_PARAMS(2);
str_params = irc_protocol_string_params (params, 1, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL),
@@ -3783,7 +3787,10 @@ IRC_PROTOCOL_CALLBACK(303)
_("%sUsers online: %s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
str_params);
if (str_params)
free (str_params);
return WEECHAT_RC_OK;
}
+3 -3
View File
@@ -2288,11 +2288,11 @@ TEST(IrcProtocolWithServer, 303)
{
SRV_INIT;
/* not enough arguments */
/* not enough parameters */
RECV(":server 303");
CHECK_ERROR_ARGS("303", 2, 4);
CHECK_ERROR_PARAMS("303", 0, 2);
RECV(":server 303 alice");
CHECK_ERROR_ARGS("303", 3, 4);
CHECK_ERROR_PARAMS("303", 1, 2);
RECV(":server 303 alice :nick1 nick2");
CHECK_SRV("-- Users online: nick1 nick2");