diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2016-01-17 08:24:53 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2016-01-17 08:24:53 +0100 |
commit | efb23016fe7c2f70ca62deec99201b2d7196d652 (patch) | |
tree | f8d792e4905f9ed90de4f47e503eb44a2b6fab67 /src | |
parent | 68b70fb185413a653acdd1b2f72a48aef498bd51 (diff) | |
download | weechat-efb23016fe7c2f70ca62deec99201b2d7196d652.zip |
irc: do not exit from function in case of error with "ctcp *"
When "*" is a target in the middle of a list, for example
"#chan1,*,#chan2", if there's an error with "*", the CTCP should be sent
to #chan1 and #chan2, even if "*" fails (and not only #chan1 like it was
previously).
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-command.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index f5f344a0b..168664159 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1366,7 +1366,8 @@ int irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - char **targets, *ctcp_target, *ctcp_type, *ctcp_args, str_time[512]; + char **targets, *ctcp_type, str_time[512]; + const char *ctcp_target, *ctcp_args; int num_targets, arg_target, arg_type, arg_args, i; struct timeval tv; @@ -1433,31 +1434,34 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, _("%s%s: \"%s\" command can only be executed in a channel " "or private buffer"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "ctcp *"); - return WEECHAT_RC_OK; + ctcp_target = NULL; } - - ctcp_target = ptr_channel->name; + else + ctcp_target = ptr_channel->name; } - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, - "PRIVMSG %s :\01%s%s%s\01", - ctcp_target, - ctcp_type, - (ctcp_args) ? " " : "", - (ctcp_args) ? ctcp_args : ""); - weechat_printf ( - irc_msgbuffer_get_target_buffer ( - ptr_server, ctcp_target, NULL, "ctcp", NULL), - _("%sCTCP query to %s%s%s: %s%s%s%s%s"), - weechat_prefix ("network"), - irc_nick_color_for_msg (ptr_server, 0, NULL, ctcp_target), - ctcp_target, - IRC_COLOR_RESET, - IRC_COLOR_CHAT_CHANNEL, - ctcp_type, - IRC_COLOR_RESET, - (ctcp_args) ? " " : "", - (ctcp_args) ? ctcp_args : ""); + if (ctcp_target) + { + irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + "PRIVMSG %s :\01%s%s%s\01", + ctcp_target, + ctcp_type, + (ctcp_args) ? " " : "", + (ctcp_args) ? ctcp_args : ""); + weechat_printf ( + irc_msgbuffer_get_target_buffer ( + ptr_server, ctcp_target, NULL, "ctcp", NULL), + _("%sCTCP query to %s%s%s: %s%s%s%s%s"), + weechat_prefix ("network"), + irc_nick_color_for_msg (ptr_server, 0, NULL, ctcp_target), + ctcp_target, + IRC_COLOR_RESET, + IRC_COLOR_CHAT_CHANNEL, + ctcp_type, + IRC_COLOR_RESET, + (ctcp_args) ? " " : "", + (ctcp_args) ? ctcp_args : ""); + } } free (ctcp_type); |