From 05ecb785fb463e5fa51869d11c031883d1d7380c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 30 Jan 2002 01:57:34 +0000 Subject: [PATCH] "/MODE #channel -k" automatically appends the channel key if it wasn't given. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2360 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/modes.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index 84ac123a..b8c98b37 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -531,7 +531,18 @@ void channel_set_mode(IRC_SERVER_REC *server, const char *channel, count++; arg = cmd_get_param(&modestr); - if (*arg != '\0') g_string_sprintfa(targs, " %s", arg); + if (*arg == '\0' && type == '-' && *curmode == 'k') { + /* "/mode #channel -k" - no reason why it + shouldn't work really, so append the key */ + IRC_CHANNEL_REC *chanrec; + + chanrec = irc_channel_find(server, channel); + if (chanrec != NULL && chanrec->key != NULL) + arg = chanrec->key; + } + + if (*arg != '\0') + g_string_sprintfa(targs, " %s", arg); } }