summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/irc/irc-protocol.c12
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp4
2 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index d391ade53..b927f388e 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -2528,10 +2528,16 @@ IRC_PROTOCOL_CALLBACK(part)
IRC_PROTOCOL_CALLBACK(ping)
{
- IRC_PROTOCOL_MIN_ARGS(2);
+ char *str_params;
- irc_server_sendf (server, 0, NULL, "PONG :%s",
- (argv_eol[1][0] == ':') ? argv_eol[1] + 1 : argv_eol[1]);
+ IRC_PROTOCOL_MIN_PARAMS(1);
+
+ str_params = irc_protocol_string_params (params, 0, num_params - 1);
+
+ irc_server_sendf (server, 0, NULL, "PONG :%s", str_params);
+
+ if (str_params)
+ free (str_params);
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 ec1c50059..d1a3faa5f 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -1526,9 +1526,9 @@ TEST(IrcProtocolWithServer, ping)
{
SRV_INIT;
- /* not enough arguments, no response */
+ /* not enough parameters, no response */
RECV("PING");
- CHECK_ERROR_ARGS("ping", 1, 2);
+ CHECK_ERROR_PARAMS("ping", 0, 1);
CHECK_SENT(NULL);
RECV("PING :123456789");