summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-05-11 16:06:45 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-05-11 16:06:45 +0000
commit7a1e526391d1d2f320325076ec4259a7c2a53e68 (patch)
treec3c5e96e24aa2421d962edba8dffa86980286cb5 /src
parente3b33796ff29574e3c91c07e2aa3d669b3cd4760 (diff)
downloadirssi-7a1e526391d1d2f320325076ec4259a7c2a53e68.zip
MODE +k handler was buggy
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1483 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/irc/core/modes.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c
index 794aff7d..a1d4dedf 100644
--- a/src/irc/core/modes.c
+++ b/src/irc/core/modes.c
@@ -211,14 +211,9 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
curmode = cmd_get_param(&modestr);
while (*curmode != '\0') {
if (HAS_MODE_ARG(type, *curmode)) {
- /* get the argument for the mode. since we're
- expecting argument, ignore the mode if there's
- no argument (shouldn't happen). */
+ /* get the argument for the mode. NOTE: We don't
+ get the +k's argument when joining to channel. */
arg = cmd_get_param(&modestr);
- if (*arg == '\0') {
- curmode++;
- continue;
- }
} else {
arg = NULL;
}
@@ -267,10 +262,17 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
channel->limit = type == '-' ? 0 : atoi(arg);
break;
case 'k':
+ if (*arg == '\0' && type == '+') {
+ arg = channel->key != NULL ? channel->key :
+ "???";
+ }
mode_set_arg(newmode, type, 'k', arg);
- g_free_and_null(channel->key);
- if (type == '+')
- channel->key = g_strdup(arg);
+
+ if (arg != channel->key) {
+ g_free_and_null(channel->key);
+ if (type == '+')
+ channel->key = g_strdup(arg);
+ }
break;
default: