fix auto away after a connection cut. Fixes #4473

This commit is contained in:
Yann Leboulanger 2008-11-13 21:37:46 +00:00
parent ee92f892f3
commit 0641beb5d4
1 changed files with 10 additions and 6 deletions

View File

@ -1787,19 +1787,23 @@ class Interface:
gajim.block_signed_in_notifications[account] = True
self.roster.set_actions_menu_needs_rebuild()
self.roster.draw_account(account)
if self.sleeper.getState() != common.sleepy.STATE_UNKNOWN and \
gajim.connections[account].connected in (2, 3):
state = self.sleeper.getState()
connected = gajim.connections[account].connected
if state != common.sleepy.STATE_UNKNOWN and connected in (2, 3):
# we go online or free for chat, so we activate auto status
gajim.sleeper_state[account] = 'online'
else:
elif not ((state == common.sleepy.STATE_AWAY and connected == 4) or \
(state == common.sleepy.STATE_XA and connected == 5)):
# If we are autoaway/xa and come back after a disconnection, do nothing
# Else disable autoaway
gajim.sleeper_state[account] = 'off'
invisible_show = gajim.SHOW_LIST.index('invisible')
# We cannot join rooms if we are invisible
if gajim.connections[account].connected == invisible_show:
return
# join already open groupchats
for gc_control in self.msg_win_mgr.get_controls(message_control.TYPE_GC) + \
self.minimized_controls[account].values():
for gc_control in self.msg_win_mgr.get_controls(message_control.TYPE_GC) \
+ self.minimized_controls[account].values():
if account != gc_control.account:
continue
room_jid = gc_control.room_jid