it was possible to send several time the autoaway / xa status before the first one is recieved by the server and taken into account.
This commit is contained in:
parent
528e353cee
commit
707e8f3874
|
@ -1358,25 +1358,31 @@ class plugin:
|
||||||
|
|
||||||
def read_sleepy(self):
|
def read_sleepy(self):
|
||||||
"""Check if we are idle"""
|
"""Check if we are idle"""
|
||||||
if self.sleeper:
|
if not self.sleeper:
|
||||||
self.sleeper.poll()
|
return 1
|
||||||
state = self.sleeper.getState()
|
self.sleeper.poll()
|
||||||
for account in self.accounts.keys():
|
state = self.sleeper.getState()
|
||||||
if self.sleeper_state[account]:
|
for account in self.accounts.keys():
|
||||||
if state == common.sleepy.STATE_AWAKE and \
|
if not self.sleeper_state[account]:
|
||||||
self.connected[account] > 1:
|
continue
|
||||||
#we go online
|
if state == common.sleepy.STATE_AWAKE and \
|
||||||
self.send('STATUS', account, ('online', ''))
|
self.sleeper_state[account] > 1:
|
||||||
elif state == common.sleepy.STATE_AWAY and \
|
#we go online
|
||||||
self.connected[account] == 1 and \
|
self.send('STATUS', account, ('online', ''))
|
||||||
self.config['autoaway']:
|
self.sleeper_state[account] = 1
|
||||||
#we go away
|
elif state == common.sleepy.STATE_AWAY and \
|
||||||
self.send('STATUS', account, ('away', 'auto away (idle)'))
|
self.sleeper_state[account] == 1 and \
|
||||||
elif state == common.sleepy.STATE_XAWAY and \
|
self.config['autoaway']:
|
||||||
self.connected[account] == 2 and \
|
#we go away
|
||||||
self.config['autoxa']:
|
self.send('STATUS', account, ('away', 'auto away (idle)'))
|
||||||
#we go extended away
|
self.sleeper_state[account] = 2
|
||||||
self.send('STATUS', account, ('xa', 'auto away (idle)'))
|
elif state == common.sleepy.STATE_XAWAY and (\
|
||||||
|
self.sleeper_state[account] == 2 or \
|
||||||
|
self.sleeper_state[account] == 1) and \
|
||||||
|
self.config['autoxa']:
|
||||||
|
#we go extended away
|
||||||
|
self.send('STATUS', account, ('xa', 'auto away (idle)'))
|
||||||
|
self.sleeper_state[account] = 3
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def __init__(self, quIN, quOUT):
|
def __init__(self, quIN, quOUT):
|
||||||
|
@ -1409,7 +1415,10 @@ class plugin:
|
||||||
self.queues[a] = {}
|
self.queues[a] = {}
|
||||||
self.connected[a] = 0
|
self.connected[a] = 0
|
||||||
self.nicks[a] = self.accounts[a]['name']
|
self.nicks[a] = self.accounts[a]['name']
|
||||||
self.sleeper_state[a] = 0
|
self.sleeper_state[a] = 0 #0:don't use sleeper for this account
|
||||||
|
#1:online and use sleeper
|
||||||
|
#2:autoaway and use sleeper
|
||||||
|
#3:autoxa and use sleeper
|
||||||
self.roster = roster_Window(self)
|
self.roster = roster_Window(self)
|
||||||
gtk.timeout_add(100, self.read_queue)
|
gtk.timeout_add(100, self.read_queue)
|
||||||
gtk.timeout_add(1000, self.read_sleepy)
|
gtk.timeout_add(1000, self.read_sleepy)
|
||||||
|
|
Loading…
Reference in New Issue