Fix reconnecting to keyed channels

closes #16
This commit is contained in:
TingPing 2013-03-11 10:22:37 -03:00
parent 9f7af7c4e4
commit 8f82d31db1
1 changed files with 11 additions and 2 deletions

View File

@ -1053,8 +1053,17 @@ check_autojoin_channels (server *serv)
if (po)
*po = 0;
channels = g_slist_append (channels, g_strdup (sess->waitchannel));
keys = g_slist_append (keys, g_strdup (sess->channelkey));
/* There can be no gap between keys, list keyed chans first. */
if (sess->channelkey[0] != 0)
{
channels = g_slist_prepend (channels, g_strdup (sess->waitchannel));
keys = g_slist_prepend (keys, g_strdup (sess->channelkey));
}
else
{
channels = g_slist_append (channels, g_strdup (sess->waitchannel));
keys = g_slist_append (keys, g_strdup (sess->channelkey));
}
i++;
}
}