Use one function to join bookmarks automatically only. Fix bug "all bookmarks joined minimized when going back

from invisible". Not sure it's right place for this function.
This commit is contained in:
Jean-Marie Traissard 2008-04-19 23:39:09 +00:00
parent b9fd96c863
commit 0374e72b28
2 changed files with 14 additions and 19 deletions

View File

@ -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]

View File

@ -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