diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-02-10 13:01:04 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-02-10 13:01:04 +0100 |
commit | 0d4513a137ad6a39fa077a0efae50d00e8051763 (patch) | |
tree | ca69ded6afd569dc0d740c422023f95839d200db /src/plugins/irc | |
parent | e42e3e309e95875206397aeb4b8faaa396c2407b (diff) | |
download | weechat-0d4513a137ad6a39fa077a0efae50d00e8051763.zip |
Authorize IRC commands msg/notice/query/quote outside IRC buffers if option "-server" is given
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-command.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index e99c83064..c98a4f40c 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1987,12 +1987,9 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, char *string; IRC_GET_SERVER_CHANNEL(buffer); - if (!ptr_server || !ptr_server->is_connected) - return WEECHAT_RC_ERROR; /* make C compiler happy */ (void) data; - (void) argv_eol; if (argc <= 2) { @@ -2005,13 +2002,14 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, if ((argc >= 5) && (weechat_strcasecmp (argv[1], "-server") == 0)) { ptr_server = irc_server_search (argv[2]); - if (!ptr_server || !ptr_server->is_connected) - return WEECHAT_RC_ERROR; ptr_channel = NULL; arg_target = 3; arg_text = 4; } + if (!ptr_server || !ptr_server->is_connected) + return WEECHAT_RC_ERROR; + targets = weechat_string_explode (argv[arg_target], ",", 0, 0, &num_targets); if (targets) @@ -2245,13 +2243,10 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc, int arg_nick, arg_text; IRC_GET_SERVER(buffer); - if (!ptr_server || !ptr_server->is_connected) - return WEECHAT_RC_ERROR; /* make C compiler happy */ (void) data; - (void) argv; - + if (argc > 2) { arg_nick = 1; @@ -2259,11 +2254,13 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc, if ((argc >= 5) && (weechat_strcasecmp (argv[1], "-server") == 0)) { ptr_server = irc_server_search (argv[2]); - if (!ptr_server || !ptr_server->is_connected) - return WEECHAT_RC_ERROR; arg_nick = 3; arg_text = 4; } + + if (!ptr_server || !ptr_server->is_connected) + return WEECHAT_RC_ERROR; + string = irc_color_decode (argv_eol[arg_text], weechat_config_boolean (irc_config_network_colors_receive)); weechat_printf (ptr_server->buffer, @@ -2511,8 +2508,6 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc, int arg_nick, arg_text; IRC_GET_SERVER_CHANNEL(buffer); - if (!ptr_server || !ptr_server->is_connected) - return WEECHAT_RC_ERROR; /* make C compiler happy */ (void) data; @@ -2524,12 +2519,13 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc, if ((argc >= 4) && (weechat_strcasecmp (argv[1], "-server") == 0)) { ptr_server = irc_server_search (argv[2]); - if (!ptr_server || !ptr_server->is_connected) - return WEECHAT_RC_ERROR; arg_nick = 3; arg_text = 4; } + if (!ptr_server || !ptr_server->is_connected) + return WEECHAT_RC_ERROR; + /* create private window if not already opened */ ptr_channel = irc_channel_search (ptr_server, argv[arg_nick]); if (!ptr_channel) @@ -2579,12 +2575,9 @@ irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { IRC_GET_SERVER(buffer); - if (!ptr_server || (ptr_server->sock < 0)) - return WEECHAT_RC_ERROR; /* make C compiler happy */ (void) data; - (void) argv; if (argc > 1) { @@ -2597,6 +2590,8 @@ irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc, } else { + if (!ptr_server || (ptr_server->sock < 0)) + return WEECHAT_RC_ERROR; irc_server_sendf (ptr_server, "%s", argv_eol[1]); } } |