1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 06:46:38 +02:00

irc: use parsed command parameters in "331" command callback

This commit is contained in:
Sébastien Helleu
2021-10-16 10:14:15 +02:00
parent a5e470a16a
commit de567aa1d3
2 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -4573,7 +4573,7 @@ IRC_PROTOCOL_CALLBACK(330_343)
* Callback for the IRC command "331": no topic for channel.
*
* Command looks like:
* :server 331 mynick #channel :There isn't a topic.
* 331 mynick #channel :There isn't a topic.
*/
IRC_PROTOCOL_CALLBACK(331)
@@ -4581,19 +4581,19 @@ IRC_PROTOCOL_CALLBACK(331)
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_MIN_PARAMS(2);
ptr_channel = irc_channel_search (server, argv[3]);
ptr_channel = irc_channel_search (server, params[1]);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, argv[3], command, NULL, ptr_buffer),
server, params[1], command, NULL, ptr_buffer),
date,
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
_("%sNo topic set for channel %s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_CHANNEL,
argv[3]);
params[1]);
return WEECHAT_RC_OK;
}
+3 -3
View File
@@ -2787,11 +2787,11 @@ TEST(IrcProtocolWithServer, 331)
{
SRV_INIT_JOIN;
/* not enough arguments */
/* not enough parameters */
RECV(":server 331");
CHECK_ERROR_ARGS("331", 2, 4);
CHECK_ERROR_PARAMS("331", 0, 2);
RECV(":server 331 alice");
CHECK_ERROR_ARGS("331", 3, 4);
CHECK_ERROR_PARAMS("331", 1, 2);
RECV(":server 331 alice #test");
CHECK_CHAN("-- No topic set for channel #test");