diff --git a/src/gajim.py b/src/gajim.py index 8b723511a..e6d4e7df4 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1532,16 +1532,7 @@ class Interface: if gajim.connections[account].connected == invisible_show: return - # join autojoinable rooms - for bm in bms: - if bm['autojoin'] in ('1', 'true'): - jid = bm['jid'] - if not gajim.gc_connected[account].has_key(jid) or \ - not gajim.gc_connected[account][jid]: - # we are not already connected - minimize = bm['minimize'] in ('1', 'true') - self.roster.join_gc_room(account, jid, bm['nick'], - bm['password'], minimize = minimize) + self.roster.auto_join_bookmarks(account) def handle_event_file_send_error(self, account, array): jid = array[0] diff --git a/src/roster_window.py b/src/roster_window.py index 40fbabd14..fda80adfd 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -3562,15 +3562,7 @@ class RosterWindow: gc_control.room_jid, None) if was_invisible and status != 'offline': # We come back from invisible, join bookmarks - for bm in gajim.connections[account].bookmarks: - if bm['autojoin'] not in ('1', 'true'): - continue - room_jid = bm['jid'] - if room_jid in gajim.gc_connected[account] and \ - gajim.gc_connected[account][room_jid]: - continue - self.join_gc_room(account, room_jid, bm['nick'], bm['password'], - minimize = bm['minimize']) + self.auto_join_bookmarks(account) def get_status_message(self, show): if show in gajim.config.get_per('defaultstatusmsg'): @@ -3585,6 +3577,18 @@ class RosterWindow: message = dlg.run() return message + def auto_join_bookmarks(self, account): + '''autojoin bookmarks that have 'auto join' on for this account''' + for bm in gajim.connections[account].bookmarks: + if bm['autojoin'] in ('1', 'true'): + jid = bm['jid'] + if not gajim.gc_connected[account].has_key(jid) or \ + not gajim.gc_connected[account][jid]: + # we are not already connected + minimize = bm['minimize'] in ('1', 'true') + self.join_gc_room(account, jid, bm['nick'], + bm['password'], minimize = minimize) + def connected_rooms(self, account): if True in gajim.gc_connected[account].values(): return True