summaryrefslogtreecommitdiff
path: root/src/plugins/relay
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-08-09 16:14:44 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-08-09 16:14:44 +0200
commitddd7a85f2dc0f335abe727699db50554818e6af4 (patch)
treed50d8f00a2d587af716dbfeaf6f7bc1320a6e6f7 /src/plugins/relay
parenta538a9c08e741e3ef5e569c3e0435e6ea358a323 (diff)
downloadweechat-ddd7a85f2dc0f335abe727699db50554818e6af4.zip
relay: fix crash when an IRC "MODE" command is received from client without arguments
Diffstat (limited to 'src/plugins/relay')
-rw-r--r--src/plugins/relay/irc/relay-irc.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c
index f210169d7..18131b4c1 100644
--- a/src/plugins/relay/irc/relay-irc.c
+++ b/src/plugins/relay/irc/relay-irc.c
@@ -1633,60 +1633,60 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
weechat_hashtable_set (hash_redirect, "signal", str_signal);
if (weechat_strcasecmp (irc_command, "mode") == 0)
{
- if (irc_argc == 1)
- redirect_msg = 1;
- weechat_hashtable_set (hash_redirect, "pattern",
- "mode_channel");
if (irc_argc > 0)
{
+ if (irc_argc == 1)
+ redirect_msg = 1;
+ weechat_hashtable_set (hash_redirect, "pattern",
+ "mode_channel");
weechat_hashtable_set (hash_redirect, "string",
irc_argv[0]);
- }
- snprintf (str_server_channel,
- sizeof (str_server_channel),
- "%s,%s",
- client->protocol_args,
- irc_argv[0]);
- info = weechat_info_get ("irc_is_channel",
- str_server_channel);
- if (info && (strcmp (info, "1") == 0))
- {
- /* command "MODE #channel ..." */
- if (irc_argc == 2)
+ snprintf (str_server_channel,
+ sizeof (str_server_channel),
+ "%s,%s",
+ client->protocol_args,
+ irc_argv[0]);
+ info = weechat_info_get ("irc_is_channel",
+ str_server_channel);
+ if (info && (strcmp (info, "1") == 0))
{
- if ((strcmp (irc_argv[1], "b") == 0)
- || (strcmp (irc_argv[1], "+b") == 0))
+ /* command "MODE #channel ..." */
+ if (irc_argc == 2)
{
- redirect_msg = 1;
- weechat_hashtable_set (hash_redirect, "pattern",
- "mode_channel_ban");
+ if ((strcmp (irc_argv[1], "b") == 0)
+ || (strcmp (irc_argv[1], "+b") == 0))
+ {
+ redirect_msg = 1;
+ weechat_hashtable_set (hash_redirect, "pattern",
+ "mode_channel_ban");
+ }
+ else if ((strcmp (irc_argv[1], "e") == 0)
+ || (strcmp (irc_argv[1], "+e") == 0))
+ {
+ redirect_msg = 1;
+ weechat_hashtable_set (hash_redirect, "pattern",
+ "mode_channel_ban_exception");
+ }
+ else if ((strcmp (irc_argv[1], "I") == 0)
+ || (strcmp (irc_argv[1], "+I") == 0))
+ {
+ redirect_msg = 1;
+ weechat_hashtable_set (hash_redirect, "pattern",
+ "mode_channel_invite");
+ }
}
- else if ((strcmp (irc_argv[1], "e") == 0)
- || (strcmp (irc_argv[1], "+e") == 0))
- {
- redirect_msg = 1;
- weechat_hashtable_set (hash_redirect, "pattern",
- "mode_channel_ban_exception");
- }
- else if ((strcmp (irc_argv[1], "I") == 0)
- || (strcmp (irc_argv[1], "+I") == 0))
+ }
+ else
+ {
+ /* command "MODE nick ..." */
+ if (irc_argc == 1)
{
redirect_msg = 1;
weechat_hashtable_set (hash_redirect, "pattern",
- "mode_channel_invite");
+ "mode_user");
}
}
}
- else
- {
- /* command "MODE nick ..." */
- if (irc_argc == 1)
- {
- redirect_msg = 1;
- weechat_hashtable_set (hash_redirect, "pattern",
- "mode_user");
- }
- }
}
else if (weechat_strcasecmp (irc_command, "ison") == 0)
{