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

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

This commit is contained in:
Sébastien Helleu
2021-10-16 13:06:15 +02:00
parent 2ae974f5c3
commit 22ecfda777
2 changed files with 15 additions and 12 deletions
+12 -9
View File
@@ -5048,22 +5048,22 @@ IRC_PROTOCOL_CALLBACK(346)
* Callback for the IRC command "347": end of channel invite list.
*
* Command looks like:
* :server 347 mynick #channel :End of Channel Invite List
* 347 mynick #channel :End of Channel Invite List
*/
IRC_PROTOCOL_CALLBACK(347)
{
char *pos_args;
char *str_params;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
struct t_irc_modelist *ptr_modelist;
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_MIN_PARAMS(2);
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
str_params = (num_params > 2) ?
irc_protocol_string_params (params, 2, num_params - 1) : NULL;
ptr_channel = irc_channel_search (server, argv[3]);
ptr_channel = irc_channel_search (server, params[1]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
ptr_modelist = irc_modelist_search (ptr_channel, 'I');
@@ -5088,11 +5088,14 @@ IRC_PROTOCOL_CALLBACK(347)
weechat_prefix ("network"),
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT_CHANNEL,
argv[3],
params[1],
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
(str_params) ? " " : "",
(str_params) ? str_params : "");
if (str_params)
free (str_params);
return WEECHAT_RC_OK;
}
+3 -3
View File
@@ -3008,11 +3008,11 @@ TEST(IrcProtocolWithServer, 347)
{
SRV_INIT_JOIN;
/* not enough arguments */
/* not enough parameters */
RECV(":server 347");
CHECK_ERROR_ARGS("347", 2, 4);
CHECK_ERROR_PARAMS("347", 0, 2);
RECV(":server 347 alice");
CHECK_ERROR_ARGS("347", 3, 4);
CHECK_ERROR_PARAMS("347", 1, 2);
RECV(":server 347 alice #test");
CHECK_CHAN("-- [#test]");