From 0ed25ede49cadae6ab35941b6837e13b74db7a63 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Sun, 27 Nov 2005 09:41:48 +0000
Subject: [PATCH] join bookmarked groupchat AFTER already opened ones so we
 don't open bookmarks twice

---
 src/gajim.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/gajim.py b/src/gajim.py
index 157814d11e..283a3878ed 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -786,24 +786,24 @@ class Interface:
 		if gajim.connections[account].connected == invisible_show:
 			return
 
-		# check for autojoins
-		for bm in bms:
-			if bm['autojoin'] in ('1', 'true'):
-				self.roster.join_gc_room(account, bm['jid'], bm['nick'],
-					bm['password'])
 		# join already open groupchats # FIXME: why this happens here? nothing to do with BMs
-		for account in gajim.connections:
-			for room_jid in self.instances[account]['gc']:
+		for acct in gajim.connections:
+			for room_jid in self.instances[acct]['gc']:
 				if room_jid == 'tabbed':
 					continue
-				if not gajim.gc_connected[account][room_jid]:
+				if not gajim.gc_connected[acct][room_jid]:
 					room, server = gajim.get_room_name_and_server_from_room_jid(
 						room_jid)
-					nick = self.instances[account]['gc'][room_jid].nicks[room_jid]
+					nick = self.instances[acct]['gc'][room_jid].nicks[room_jid]
 					password = ''
 					if gajim.gc_passwords.has_key(room_jid):
 						password = gajim.gc_passwords[room_jid]
-					gajim.connections[account].join_gc(nick, room, server, password)
+					gajim.connections[acct].join_gc(nick, room, server, password)
+		# join autojoinable ones AFTER the others to not open twice bookmarks
+		for bm in bms:
+			if bm['autojoin'] in ('1', 'true'):
+				self.roster.join_gc_room(account, bm['jid'], bm['nick'],
+					bm['password'])
 								
 	def handle_event_file_send_error(self, account, array):
 		jid = array[0]
-- 
GitLab