mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 11:43:13 +02:00
irc: use parsed command parameters in "345" command callback
This commit is contained in:
@@ -4898,12 +4898,16 @@ IRC_PROTOCOL_CALLBACK(344)
|
|||||||
* Callback for the IRC command "345": end of channel reop.
|
* Callback for the IRC command "345": end of channel reop.
|
||||||
*
|
*
|
||||||
* Command looks like:
|
* Command looks like:
|
||||||
* :server 345 mynick #channel :End of Channel Reop List
|
* 345 mynick #channel :End of Channel Reop List
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IRC_PROTOCOL_CALLBACK(345)
|
IRC_PROTOCOL_CALLBACK(345)
|
||||||
{
|
{
|
||||||
IRC_PROTOCOL_MIN_ARGS(5);
|
char *str_params;
|
||||||
|
|
||||||
|
IRC_PROTOCOL_MIN_PARAMS(3);
|
||||||
|
|
||||||
|
str_params = irc_protocol_string_params (params, 2, num_params - 1);
|
||||||
|
|
||||||
weechat_printf_date_tags (
|
weechat_printf_date_tags (
|
||||||
irc_msgbuffer_get_target_buffer (server, NULL, command, "reop", NULL),
|
irc_msgbuffer_get_target_buffer (server, NULL, command, "reop", NULL),
|
||||||
@@ -4912,9 +4916,12 @@ IRC_PROTOCOL_CALLBACK(345)
|
|||||||
"%s%s%s%s: %s",
|
"%s%s%s%s: %s",
|
||||||
weechat_prefix ("network"),
|
weechat_prefix ("network"),
|
||||||
IRC_COLOR_CHAT_CHANNEL,
|
IRC_COLOR_CHAT_CHANNEL,
|
||||||
argv[3],
|
params[1],
|
||||||
IRC_COLOR_RESET,
|
IRC_COLOR_RESET,
|
||||||
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
|
str_params);
|
||||||
|
|
||||||
|
if (str_params)
|
||||||
|
free (str_params);
|
||||||
|
|
||||||
return WEECHAT_RC_OK;
|
return WEECHAT_RC_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2944,13 +2944,13 @@ TEST(IrcProtocolWithServer, 345)
|
|||||||
{
|
{
|
||||||
SRV_INIT_JOIN;
|
SRV_INIT_JOIN;
|
||||||
|
|
||||||
/* not enough arguments */
|
/* not enough parameters */
|
||||||
RECV(":server 345");
|
RECV(":server 345");
|
||||||
CHECK_ERROR_ARGS("345", 2, 5);
|
CHECK_ERROR_PARAMS("345", 0, 3);
|
||||||
RECV(":server 345 alice");
|
RECV(":server 345 alice");
|
||||||
CHECK_ERROR_ARGS("345", 3, 5);
|
CHECK_ERROR_PARAMS("345", 1, 3);
|
||||||
RECV(":server 345 alice #test");
|
RECV(":server 345 alice #test");
|
||||||
CHECK_ERROR_ARGS("345", 4, 5);
|
CHECK_ERROR_PARAMS("345", 2, 3);
|
||||||
|
|
||||||
RECV(":server 345 alice #test end");
|
RECV(":server 345 alice #test end");
|
||||||
CHECK_SRV("-- #test: end");
|
CHECK_SRV("-- #test: end");
|
||||||
|
|||||||
Reference in New Issue
Block a user