summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/irc/irc-protocol.c15
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp11
2 files changed, 16 insertions, 10 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 58baed506..653ae50e4 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -4416,18 +4416,20 @@ IRC_PROTOCOL_CALLBACK(327)
* Callback for the IRC command "328": channel URL.
*
* Command looks like:
- * :server 328 mynick #channel :https://example.com/
+ * 328 mynick #channel :https://example.com/
*/
IRC_PROTOCOL_CALLBACK(328)
{
+ char *str_url;
struct t_irc_channel *ptr_channel;
- IRC_PROTOCOL_MIN_ARGS(5);
+ IRC_PROTOCOL_MIN_PARAMS(3);
- ptr_channel = irc_channel_search (server, argv[3]);
+ ptr_channel = irc_channel_search (server, params[1]);
if (ptr_channel)
{
+ str_url = irc_protocol_string_params (params, 2, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, NULL, ptr_channel->buffer),
@@ -4436,10 +4438,11 @@ IRC_PROTOCOL_CALLBACK(328)
_("%sURL for %s%s%s: %s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_CHANNEL,
- argv[3],
+ params[1],
IRC_COLOR_RESET,
- (argv_eol[4][0] == ':') ?
- argv_eol[4] + 1 : argv_eol[4]);
+ str_url);
+ if (str_url)
+ free (str_url);
}
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 8099906df..45756d782 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -2697,16 +2697,19 @@ TEST(IrcProtocolWithServer, 328)
{
SRV_INIT_JOIN;
- /* not enough arguments */
+ /* not enough parameters */
RECV(":server 328");
- CHECK_ERROR_ARGS("328", 2, 5);
+ CHECK_ERROR_PARAMS("328", 0, 3);
RECV(":server 328 alice");
- CHECK_ERROR_ARGS("328", 3, 5);
+ CHECK_ERROR_PARAMS("328", 1, 3);
RECV(":server 328 alice #test");
- CHECK_ERROR_ARGS("328", 4, 5);
+ CHECK_ERROR_PARAMS("328", 2, 3);
RECV(":server 328 alice #test :https://example.com/");
CHECK_CHAN("-- URL for #test: https://example.com/");
+ RECV(":server 328 alice #test :URL is https://example.com/");
+ CHECK_CHAN("-- URL for #test: URL is https://example.com/");
+
}
/*