mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Don't replace channel key when receiving channel mode numeric. It could be a
fake key there. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3262 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
84b23e20c2
commit
e9c3a217e3
@ -288,7 +288,7 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
|
|||||||
{
|
{
|
||||||
IRC_SERVER_REC *server = channel->server;
|
IRC_SERVER_REC *server = channel->server;
|
||||||
GString *newmode;
|
GString *newmode;
|
||||||
char *dup, *modestr, *arg, *curmode, type;
|
char *dup, *modestr, *arg, *curmode, type, *old_key;
|
||||||
int umode;
|
int umode;
|
||||||
|
|
||||||
g_return_if_fail(IS_IRC_CHANNEL(channel));
|
g_return_if_fail(IS_IRC_CHANNEL(channel));
|
||||||
@ -296,6 +296,7 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
|
|||||||
|
|
||||||
type = '+';
|
type = '+';
|
||||||
newmode = g_string_new(channel->mode);
|
newmode = g_string_new(channel->mode);
|
||||||
|
old_key = update_key ? NULL : g_strdup(channel->key);
|
||||||
|
|
||||||
dup = modestr = g_strdup(mode);
|
dup = modestr = g_strdup(mode);
|
||||||
curmode = cmd_get_param(&modestr);
|
curmode = cmd_get_param(&modestr);
|
||||||
@ -337,6 +338,11 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
|
|||||||
in channel modes.. */
|
in channel modes.. */
|
||||||
g_free(channel->key);
|
g_free(channel->key);
|
||||||
channel->key = NULL;
|
channel->key = NULL;
|
||||||
|
} else if (!update_key) {
|
||||||
|
/* get the old one back, just in case it was replaced */
|
||||||
|
g_free(channel->key);
|
||||||
|
channel->key = old_key;
|
||||||
|
old_key = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(newmode->str, channel->mode) != 0) {
|
if (strcmp(newmode->str, channel->mode) != 0) {
|
||||||
@ -347,6 +353,7 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_string_free(newmode, TRUE);
|
g_string_free(newmode, TRUE);
|
||||||
|
g_free(old_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add `mode' to `old' - return newly allocated mode.
|
/* add `mode' to `old' - return newly allocated mode.
|
||||||
|
Loading…
Reference in New Issue
Block a user