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 "351" command callback

This commit is contained in:
Sébastien Helleu
2021-10-16 13:22:09 +02:00
parent cee4bf7e3c
commit 9b17f1fee4
2 changed files with 16 additions and 12 deletions
+12 -8
View File
@@ -5279,29 +5279,33 @@ IRC_PROTOCOL_CALLBACK(349)
* Callback for the IRC command "351": server version.
*
* Command looks like:
* :server 351 mynick dancer-ircd-1.0.36(2006/07/23_13:11:50). server :iMZ dncrTS/v4
* 351 mynick dancer-ircd-1.0.36(2006/07/23_13:11:50). server :iMZ dncrTS/v4
*/
IRC_PROTOCOL_CALLBACK(351)
{
char *str_params;
struct t_gui_buffer *ptr_buffer;
IRC_PROTOCOL_MIN_ARGS(5);
IRC_PROTOCOL_MIN_PARAMS(3);
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL, command, NULL,
NULL);
if (argc > 5)
if (num_params > 3)
{
str_params = irc_protocol_string_params (params, 3, num_params - 1);
weechat_printf_date_tags (
ptr_buffer,
date,
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s %s (%s)",
weechat_prefix ("network"),
argv[3],
argv[4],
(argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]);
params[1],
params[2],
str_params);
if (str_params)
free (str_params);
}
else
{
@@ -5311,8 +5315,8 @@ IRC_PROTOCOL_CALLBACK(351)
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s %s",
weechat_prefix ("network"),
argv[3],
argv[4]);
params[1],
params[2]);
}
return WEECHAT_RC_OK;
+4 -4
View File
@@ -3109,13 +3109,13 @@ TEST(IrcProtocolWithServer, 351)
{
SRV_INIT;
/* not enough arguments */
/* not enough parameters */
RECV(":server 351");
CHECK_ERROR_ARGS("351", 2, 5);
CHECK_ERROR_PARAMS("351", 0, 3);
RECV(":server 351 alice");
CHECK_ERROR_ARGS("351", 3, 5);
CHECK_ERROR_PARAMS("351", 1, 3);
RECV(":server 351 alice dancer-ircd-1.0");
CHECK_ERROR_ARGS("351", 4, 5);
CHECK_ERROR_PARAMS("351", 2, 3);
RECV(":server 351 alice dancer-ircd-1.0 server");
CHECK_SRV("-- dancer-ircd-1.0 server");