summary refs log tree commit diff stats
path: root/src/common/inbound.c
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-03-11 10:22:37 -0300
committerTingPing <tngpng@gmail.com>2013-03-11 10:22:37 -0300
commit8f82d31db1827ae444b503087b949006b6df8354 (patch)
tree726af6380e4176a87b06dd75deed0c596b977e45 /src/common/inbound.c
parent9f7af7c4e4fc96e20fafb9b74a78c2bdaba812b9 (diff)
Fix reconnecting to keyed channels
closes #16
Diffstat (limited to 'src/common/inbound.c')
-rw-r--r--src/common/inbound.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 54e5bff0..88d1e1c3 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -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++;
 			}
 		}