From fd1b276aabcf7a7e4269ca6ae72e04411212f35c Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Thu, 16 May 2013 00:04:58 +0200 Subject: [PATCH] Make sure the created favchannel instances have a NULL key when the session's key is empty --- src/common/inbound.c | 10 +++++++++- src/common/proto-irc.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/inbound.c b/src/common/inbound.c index 2f33199a..07539a63 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -1105,7 +1105,15 @@ check_autojoin_channels (server *serv) } } - sess_channels = servlist_favchan_listadd (sess_channels, sess->waitchannel, sess->channelkey); + /* for easier checks, ensure that favchannel->key is just NULL when session->channelkey is empty i.e. '' */ + if (strlen (sess->channelkey)) + { + sess_channels = servlist_favchan_listadd (sess_channels, sess->waitchannel, sess->channelkey); + } + else + { + sess_channels = servlist_favchan_listadd (sess_channels, sess->waitchannel, NULL); + } i++; } } diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index c689b814..9b375d92 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -194,7 +194,7 @@ irc_join_list (server *serv, GSList *favorites) g_string_append (chanlist, fav->name); - if (fav->key && strlen (fav->key)) /* strlen() is required since key can be '' for session->channelkey */ + if (fav->key) /* strlen() is required since key can be '' for session->channelkey */ { g_string_append (keylist, fav->key); send_keys = 1;