1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

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

This commit is contained in:
Sébastien Helleu
2021-10-16 09:34:08 +02:00
parent e412a34668
commit a1a4f337ff
2 changed files with 13 additions and 9 deletions
+9 -5
View File
@@ -4058,22 +4058,24 @@ IRC_PROTOCOL_CALLBACK(314)
* Callback for the IRC command "315": end of /who.
*
* Command looks like:
* :server 315 mynick #channel :End of /WHO list.
* 315 mynick #channel :End of /WHO list.
*/
IRC_PROTOCOL_CALLBACK(315)
{
char *str_params;
struct t_irc_channel *ptr_channel;
IRC_PROTOCOL_MIN_ARGS(5);
IRC_PROTOCOL_MIN_PARAMS(3);
ptr_channel = irc_channel_search (server, argv[3]);
ptr_channel = irc_channel_search (server, params[1]);
if (ptr_channel && (ptr_channel->checking_whox > 0))
{
ptr_channel->checking_whox--;
}
else
{
str_params = irc_protocol_string_params (params, 2, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, "who", NULL),
@@ -4083,10 +4085,12 @@ IRC_PROTOCOL_CALLBACK(315)
weechat_prefix ("network"),
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT_CHANNEL,
argv[3],
params[1],
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
str_params);
if (str_params)
free (str_params);
}
return WEECHAT_RC_OK;
+4 -4
View File
@@ -2506,13 +2506,13 @@ TEST(IrcProtocolWithServer, 315)
{
SRV_INIT_JOIN;
/* not enough arguments */
/* not enough parameters */
RECV(":server 315");
CHECK_ERROR_ARGS("315", 2, 5);
CHECK_ERROR_PARAMS("315", 0, 3);
RECV(":server 315 alice");
CHECK_ERROR_ARGS("315", 3, 5);
CHECK_ERROR_PARAMS("315", 1, 3);
RECV(":server 315 alice #test");
CHECK_ERROR_ARGS("315", 4, 5);
CHECK_ERROR_PARAMS("315", 2, 3);
RECV(":server 315 alice #test End of /WHO list.");
CHECK_SRV("-- [#test] End of /WHO list.");