From cdde62ac88e9b1dbcc3f4fb411baa5ab06010dae Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 13 Nov 2005 17:24:08 +0000 Subject: [PATCH] reconnect to all gc when connection comes back --- src/common/gajim.py | 1 + src/gajim.py | 13 +++++++++++++ src/roster_window.py | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/common/gajim.py b/src/common/gajim.py index a8d8aaec4..e4d65e584 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -69,6 +69,7 @@ encrypted_chats = {} # list of encrypted chats {acct1: [jid1, jid2], ..} contacts = {} # list of contacts {acct: {jid1: [C1, C2]}, } one Contact per resource gc_contacts = {} # list of contacts that are in gc {acct: {room_jid: {nick: C}}} gc_connected = {} # tell if we are connected to the room or not {room_jid: True} +gc_passwords = {} # list of the pass required to enter a room {room_jid: password} groups = {} # list of groups newly_added = {} # list of contacts that has just signed in diff --git a/src/gajim.py b/src/gajim.py index c2962369e..68e4006dd 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -775,6 +775,19 @@ class Interface: if bm['autojoin'] in ('1', 'true'): self.roster.join_gc_room(account, bm['jid'], bm['nick'], bm['password']) + for account in gajim.connections: + for room_jid in self.instances[account]['gc']: + if room_jid == 'tabbed': + continue + if not gajim.gc_connected[account][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] + password = '' + if gajim.gc_passwords.has_key(room_jid): + password = gajim.gc_passwords[room_jid] + gajim.connections[account].join_gc(nick, room, server, password) + self.roster.make_menu() def handle_event_file_send_error(self, account, array): diff --git a/src/roster_window.py b/src/roster_window.py index 44bcdbb37..bf4d9a823 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -294,6 +294,8 @@ class RosterWindow: gajim.interface.instances[account]['gc'][room_jid].set_active_tab(room_jid) gajim.interface.instances[account]['gc'][room_jid].window.present() gajim.connections[account].join_gc(nick, room, server, password) + if password: + gajim.gc_passwords[room_jid] = password def on_bookmark_menuitem_activate(self, widget, account, bookmark): self.join_gc_room(account, bookmark['jid'], bookmark['nick'],