From 44270041c241d7fd7b1967d537eaf9345b3ca45d Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 14 Oct 2001 13:33:22 +0000 Subject: [PATCH] Irssi lost channel key for secret/private channels after join. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1835 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/channels-query.c | 8 +++++++- src/irc/core/irc-nicklist.c | 16 +++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/irc/core/channels-query.c b/src/irc/core/channels-query.c index 79843983..345e4c23 100644 --- a/src/irc/core/channels-query.c +++ b/src/irc/core/channels-query.c @@ -408,8 +408,14 @@ static void event_channel_mode(IRC_SERVER_REC *server, const char *data, params = event_get_params(data, 3 | PARAM_FLAG_GETREST, NULL, &channel, &mode); chanrec = irc_channel_find(server, channel); - if (chanrec != NULL) + if (chanrec != NULL) { + 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, nick, mode); + } channel_got_query(server, chanrec, channel); g_free(params); diff --git a/src/irc/core/irc-nicklist.c b/src/irc/core/irc-nicklist.c index ae87edcf..42dac71d 100644 --- a/src/irc/core/irc-nicklist.c +++ b/src/irc/core/irc-nicklist.c @@ -93,11 +93,17 @@ static void event_names_list(IRC_SERVER_REC *server, const char *data) This is actually pretty useless to check here, but at least we get to know if the channel is +p or +s a few seconds before - we receive the MODE reply... */ - if (*type == '*') - parse_channel_modes(IRC_CHANNEL(chanrec), NULL, "+p"); - else if (*type == '@') - parse_channel_modes(IRC_CHANNEL(chanrec), NULL, "+s"); + we receive the MODE reply... + + If the channel key is set, assume the channel is +k also until + we know better, so parse_channel_modes() won't clear the key */ + if (*type == '*') { + parse_channel_modes(chanrec, NULL, + chanrec->key ? "+kp" : "+p"); + } else if (*type == '@') { + parse_channel_modes(chanrec, NULL, + chanrec->key ? "+ks" : "+s"); + } while (*names != '\0') { while (*names == ' ') names++;