diff --git a/src/irc/core/channels-query.c b/src/irc/core/channels-query.c index bc5ebf3a..6d54ddd9 100644 --- a/src/irc/core/channels-query.c +++ b/src/irc/core/channels-query.c @@ -405,9 +405,9 @@ static void event_channel_mode(IRC_SERVER_REC *server, const char *data, if (chanrec->key != NULL && strchr(mode, 'k') == NULL) { /* we joined the channel with a key, but it didn't have +k mode.. */ - parse_channel_modes(chanrec, NULL, "-k"); + parse_channel_modes(chanrec, NULL, "-k", TRUE); } - parse_channel_modes(chanrec, nick, mode); + parse_channel_modes(chanrec, nick, mode, FALSE); channel_got_query(chanrec, CHANNEL_QUERY_MODE); } diff --git a/src/irc/core/irc-nicklist.c b/src/irc/core/irc-nicklist.c index b928ada0..2e100dda 100644 --- a/src/irc/core/irc-nicklist.c +++ b/src/irc/core/irc-nicklist.c @@ -101,10 +101,10 @@ static void event_names_list(IRC_SERVER_REC *server, const char *data) we know better, so parse_channel_modes() won't clear the key */ if (*type == '*') { parse_channel_modes(chanrec, NULL, - chanrec->key ? "+kp" : "+p"); + chanrec->key ? "+kp" : "+p", FALSE); } else if (*type == '@') { parse_channel_modes(chanrec, NULL, - chanrec->key ? "+ks" : "+s"); + chanrec->key ? "+ks" : "+s", FALSE); } while (*names != '\0') { diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index 946b533b..0fce2e9b 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -198,7 +198,7 @@ int channel_mode_is_set(IRC_CHANNEL_REC *channel, char mode) /* Parse channel mode string */ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby, - const char *mode) + const char *mode, int update_key) { GString *newmode; char *dup, *modestr, *arg, *curmode, type; @@ -256,7 +256,7 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby, } mode_set_arg(newmode, type, 'k', arg); - if (arg != channel->key) { + if (arg != channel->key && update_key) { g_free_and_null(channel->key); if (type == '+') channel->key = g_strdup(arg); @@ -382,7 +382,7 @@ static void event_mode(IRC_SERVER_REC *server, const char *data, /* channel mode change */ chanrec = irc_channel_find(server, channel); if (chanrec != NULL) - parse_channel_modes(chanrec, nick, mode); + parse_channel_modes(chanrec, nick, mode, TRUE); } g_free(params); diff --git a/src/irc/core/modes.h b/src/irc/core/modes.h index d2e10cd9..485b176b 100644 --- a/src/irc/core/modes.h +++ b/src/irc/core/modes.h @@ -29,7 +29,7 @@ char *modes_join(const char *old, const char *mode, int channel); int channel_mode_is_set(IRC_CHANNEL_REC *channel, char mode); void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby, - const char *modestr); + const char *modestr, int update_key); void channel_set_singlemode(IRC_CHANNEL_REC *channel, const char *nicks, const char *mode);