1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

MODE +k handler was buggy

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1483 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-05-11 16:06:45 +00:00 committed by cras
parent e3b33796ff
commit 7a1e526391

View File

@ -211,14 +211,9 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
curmode = cmd_get_param(&modestr); curmode = cmd_get_param(&modestr);
while (*curmode != '\0') { while (*curmode != '\0') {
if (HAS_MODE_ARG(type, *curmode)) { if (HAS_MODE_ARG(type, *curmode)) {
/* get the argument for the mode. since we're /* get the argument for the mode. NOTE: We don't
expecting argument, ignore the mode if there's get the +k's argument when joining to channel. */
no argument (shouldn't happen). */
arg = cmd_get_param(&modestr); arg = cmd_get_param(&modestr);
if (*arg == '\0') {
curmode++;
continue;
}
} else { } else {
arg = NULL; arg = NULL;
} }
@ -267,10 +262,17 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
channel->limit = type == '-' ? 0 : atoi(arg); channel->limit = type == '-' ? 0 : atoi(arg);
break; break;
case 'k': case 'k':
if (*arg == '\0' && type == '+') {
arg = channel->key != NULL ? channel->key :
"???";
}
mode_set_arg(newmode, type, 'k', arg); mode_set_arg(newmode, type, 'k', arg);
g_free_and_null(channel->key);
if (type == '+') if (arg != channel->key) {
channel->key = g_strdup(arg); g_free_and_null(channel->key);
if (type == '+')
channel->key = g_strdup(arg);
}
break; break;
default: default: