diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-05-20 10:41:51 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-05-20 10:41:51 +0000 |
commit | 4061f0641daebbcd0567b2df7c469b8d8c630936 (patch) | |
tree | 895cf6a1c2f2f76486d4f577afa52e8d4f764e7d /src | |
parent | 5787acad2c19c501444b3eec495ce92928a9708c (diff) | |
download | weechat-4061f0641daebbcd0567b2df7c469b8d8c630936.zip |
Fixed IRC mode parsing when receiving modes with arguments (bug #19902)
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/irc-mode.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/irc/irc-mode.c b/src/irc/irc-mode.c index 05e00460f..c6f59222d 100644 --- a/src/irc/irc-mode.c +++ b/src/irc/irc-mode.c @@ -117,15 +117,17 @@ irc_mode_channel_set (t_irc_channel *channel, char *modes) break; default: set_flag = irc_mode_channel_get_flag (modes, pos); - ptr_arg = ((argc > 0) && (current_arg >= 0)) ? - argv[current_arg--] : NULL; switch (pos[0]) { case 'a': /* unrealircd specific flag */ + ptr_arg = ((argc > 0) && (current_arg >= 0)) ? + argv[current_arg--] : NULL; irc_mode_channel_set_nick (channel, ptr_arg, set_flag, NICK_CHANADMIN); break; case 'h': + ptr_arg = ((argc > 0) && (current_arg >= 0)) ? + argv[current_arg--] : NULL; irc_mode_channel_set_nick (channel, ptr_arg, set_flag, NICK_HALFOP); break; @@ -135,24 +137,40 @@ irc_mode_channel_set (t_irc_channel *channel, char *modes) free (channel->key); channel->key = NULL; } - if ((set_flag == '+') && ptr_arg) - channel->key = strdup (ptr_arg); + if (set_flag == '+') + { + ptr_arg = ((argc > 0) && (current_arg >= 0)) ? + argv[current_arg--] : NULL; + if (ptr_arg) + channel->key = strdup (ptr_arg); + } break; case 'l': if (set_flag == '-') channel->limit = 0; - if ((set_flag == '+') && ptr_arg) - channel->limit = atoi (ptr_arg); + if (set_flag == '+') + { + ptr_arg = ((argc > 0) && (current_arg >= 0)) ? + argv[current_arg--] : NULL; + if (ptr_arg) + channel->limit = atoi (ptr_arg); + } break; case 'o': + ptr_arg = ((argc > 0) && (current_arg >= 0)) ? + argv[current_arg--] : NULL; irc_mode_channel_set_nick (channel, ptr_arg, set_flag, NICK_OP); break; case 'q': /* unrealircd specific flag */ + ptr_arg = ((argc > 0) && (current_arg >= 0)) ? + argv[current_arg--] : NULL; irc_mode_channel_set_nick (channel, ptr_arg, set_flag, NICK_CHANOWNER); break; case 'v': + ptr_arg = ((argc > 0) && (current_arg >= 0)) ? + argv[current_arg--] : NULL; irc_mode_channel_set_nick (channel, ptr_arg, set_flag, NICK_VOICE); break; |