when we go autoaway, we save our status message so we restore it when we come back online
This commit is contained in:
parent
2d09389632
commit
0274905793
|
@ -59,6 +59,7 @@ sleeper_state = {} # whether we pass auto away / xa or not
|
|||
#'online': online and use sleeper
|
||||
#'autoaway': autoaway and use sleeper
|
||||
#'autoxa': autoxa and use sleeper
|
||||
status_before_autoaway = {}
|
||||
|
||||
|
||||
def get_fjid_from_nick(room_jid, nick):
|
||||
|
|
|
@ -1175,6 +1175,8 @@ _('To change the account name, you must be disconnected.')).get_response()
|
|||
gajim.encrypted_chats[name] = gajim.encrypted_chats[self.account]
|
||||
gajim.last_message_time[name] = \
|
||||
gajim.last_message_time[self.account]
|
||||
gajim.status_before_autoaway[name] = \
|
||||
gajim.status_before_autoaway[self.account]
|
||||
|
||||
#upgrade account variable in opened windows
|
||||
for kind in ['infos', 'chats', 'gc', 'gc_config']:
|
||||
|
@ -1198,6 +1200,7 @@ _('To change the account name, you must be disconnected.')).get_response()
|
|||
del gajim.sleeper_state[self.account]
|
||||
del gajim.encrypted_chats[self.account]
|
||||
del gajim.last_message_time[self.account]
|
||||
del gajim.status_before_autoaway[self.account]
|
||||
gajim.connections[self.account].name = name
|
||||
gajim.connections[name] = gajim.connections[self.account]
|
||||
del gajim.connections[self.account]
|
||||
|
@ -1249,6 +1252,7 @@ _('To change the account name, you must be disconnected.')).get_response()
|
|||
gajim.sleeper_state[name] = 'off'
|
||||
gajim.encrypted_chats[name] = []
|
||||
gajim.last_message_time[name] = {}
|
||||
gajim.status_before_autoaway[name] = ''
|
||||
#refresh accounts window
|
||||
if self.plugin.windows.has_key('accounts'):
|
||||
self.plugin.windows['accounts'].init_accounts()
|
||||
|
@ -2344,6 +2348,7 @@ class RemoveAccountWindow:
|
|||
del gajim.sleeper_state[self.account]
|
||||
del gajim.encrypted_chats[self.account]
|
||||
del gajim.last_message_time[self.account]
|
||||
del gajim.status_before_autoaway[self.account]
|
||||
self.plugin.roster.draw_roster()
|
||||
if self.plugin.windows.has_key('accounts'):
|
||||
self.plugin.windows['accounts'].init_accounts()
|
||||
|
|
|
@ -566,6 +566,7 @@ class Interface:
|
|||
gajim.sleeper_state[name] = 'off'
|
||||
gajim.encrypted_chats[name] = []
|
||||
gajim.last_message_time[name] = {}
|
||||
gajim.status_before_autoaway[name] = {}
|
||||
if self.windows.has_key('accounts'):
|
||||
self.windows['accounts'].init_accounts()
|
||||
self.roster.draw_roster()
|
||||
|
@ -704,11 +705,15 @@ class Interface:
|
|||
gajim.sleeper_state[account] == 'autoaway' or \
|
||||
gajim.sleeper_state[account] == 'autoxa':
|
||||
#we go online
|
||||
self.roster.send_status(account, 'online', 'Online')
|
||||
self.roster.send_status(account, 'online',
|
||||
gajim.status_before_autoaway[account])
|
||||
gajim.sleeper_state[account] = 'online'
|
||||
elif state == common.sleepy.STATE_AWAY and \
|
||||
gajim.sleeper_state[account] == 'online' and \
|
||||
gajim.config.get('autoaway'):
|
||||
#we save out online status
|
||||
gajim.status_before_autoaway[account] = \
|
||||
gajim.connections[account].status
|
||||
#we go away
|
||||
self.roster.send_status(account, 'away', 'auto away (idle)')
|
||||
gajim.sleeper_state[account] = 'autoaway'
|
||||
|
@ -953,6 +958,7 @@ class Interface:
|
|||
gajim.sleeper_state[a] = 0
|
||||
gajim.encrypted_chats[a] = []
|
||||
gajim.last_message_time[a] = {}
|
||||
gajim.status_before_autoaway[a] = ''
|
||||
|
||||
self.roster = roster_window.RosterWindow(self)
|
||||
if gajim.config.get('use_dbus'):
|
||||
|
|
Loading…
Reference in New Issue