mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
irc: use parsed command parameters in "438" command callback
This commit is contained in:
@@ -6297,29 +6297,33 @@ IRC_PROTOCOL_CALLBACK(437)
|
||||
* Callback for the IRC command "438": not authorized to change nickname.
|
||||
*
|
||||
* Command looks like:
|
||||
* :server 438 mynick newnick :Nick change too fast. Please wait 30 seconds.
|
||||
* 438 mynick newnick :Nick change too fast. Please wait 30 seconds.
|
||||
*/
|
||||
|
||||
IRC_PROTOCOL_CALLBACK(438)
|
||||
{
|
||||
char *str_params;
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
|
||||
IRC_PROTOCOL_MIN_ARGS(4);
|
||||
IRC_PROTOCOL_MIN_PARAMS(2);
|
||||
|
||||
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, 2, 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_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4],
|
||||
argv[2],
|
||||
argv[3]);
|
||||
str_params,
|
||||
params[0],
|
||||
params[1]);
|
||||
if (str_params)
|
||||
free (str_params);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6329,8 +6333,8 @@ IRC_PROTOCOL_CALLBACK(438)
|
||||
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
|
||||
"%s%s %s",
|
||||
weechat_prefix ("network"),
|
||||
argv[2],
|
||||
argv[3]);
|
||||
params[0],
|
||||
params[1]);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -3774,11 +3774,11 @@ TEST(IrcProtocolWithServer, 438)
|
||||
{
|
||||
SRV_INIT;
|
||||
|
||||
/* not enough arguments */
|
||||
/* not enough parameters */
|
||||
RECV(":server 438");
|
||||
CHECK_ERROR_ARGS("438", 2, 4);
|
||||
CHECK_ERROR_PARAMS("438", 0, 2);
|
||||
RECV(":server 438 alice");
|
||||
CHECK_ERROR_ARGS("438", 3, 4);
|
||||
CHECK_ERROR_PARAMS("438", 1, 2);
|
||||
|
||||
RECV(":server 438 alice alice2");
|
||||
CHECK_SRV("-- alice alice2");
|
||||
|
||||
Reference in New Issue
Block a user