summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/irc/irc-protocol.c20
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp6
2 files changed, 15 insertions, 11 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 8bff30513..e99e70b7c 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -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;
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index cb0d5754c..91c8746f5 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -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");