disconnect pending proxy resolve actions when
account is disconnected from server
This commit is contained in:
parent
7165a72157
commit
c16167025c
|
@ -138,6 +138,7 @@ class Connection(ConnectionHandlers):
|
||||||
self.old_show = STATUS_LIST[self.connected]
|
self.old_show = STATUS_LIST[self.connected]
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
self.dispatch('STATUS', 'offline')
|
self.dispatch('STATUS', 'offline')
|
||||||
|
gajim.proxy65_manager.disconnect(self.connection)
|
||||||
self.connection = None
|
self.connection = None
|
||||||
if not self.on_purpose:
|
if not self.on_purpose:
|
||||||
if gajim.config.get_per('accounts', self.name, 'autoreconnect'):
|
if gajim.config.get_per('accounts', self.name, 'autoreconnect'):
|
||||||
|
@ -561,6 +562,7 @@ class Connection(ConnectionHandlers):
|
||||||
def _on_disconnected(self):
|
def _on_disconnected(self):
|
||||||
''' called when a disconnect request has completed successfully'''
|
''' called when a disconnect request has completed successfully'''
|
||||||
self.dispatch('STATUS', 'offline')
|
self.dispatch('STATUS', 'offline')
|
||||||
|
gajim.proxy65_manager.disconnect(self.connection)
|
||||||
self.connection = None
|
self.connection = None
|
||||||
|
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
|
|
|
@ -54,8 +54,8 @@ class Proxy65Manager:
|
||||||
# resolving this proxy is already started or completed
|
# resolving this proxy is already started or completed
|
||||||
return
|
return
|
||||||
|
|
||||||
def diconnect(self, connection):
|
def disconnect(self, connection):
|
||||||
for resolver in self.proxies:
|
for resolver in self.proxies.values():
|
||||||
resolver.disconnect(connection)
|
resolver.disconnect(connection)
|
||||||
|
|
||||||
def resolve_result(self, proxy, query):
|
def resolve_result(self, proxy, query):
|
||||||
|
@ -103,8 +103,11 @@ class ProxyResolver:
|
||||||
query.setAttr('sid', self.sid)
|
query.setAttr('sid', self.sid)
|
||||||
activate = query.setTag('activate')
|
activate = query.setTag('activate')
|
||||||
# activate.setData(self.jid + "/" + self.sid)
|
# activate.setData(self.jid + "/" + self.sid)
|
||||||
self.active_connection.send(iq)
|
if self.active_connection:
|
||||||
self.state = S_ACTIVATED
|
self.active_connection.send(iq)
|
||||||
|
self.state = S_ACTIVATED
|
||||||
|
else:
|
||||||
|
self.state = S_INITIAL
|
||||||
|
|
||||||
def keep_conf(self):
|
def keep_conf(self):
|
||||||
self.state = S_FINISHED
|
self.state = S_FINISHED
|
||||||
|
@ -119,11 +122,15 @@ class ProxyResolver:
|
||||||
if self.host_tester:
|
if self.host_tester:
|
||||||
self.host_tester.disconnect()
|
self.host_tester.disconnect()
|
||||||
self.host_tester = None
|
self.host_tester = None
|
||||||
if self.connections.has_key(connection):
|
try:
|
||||||
self.connections.remove(connection)
|
self.connections.remove(connection)
|
||||||
if self.state == S_STARTED:
|
except ValueError:
|
||||||
self.state = S_INITIAL
|
pass
|
||||||
self.try_next_connection()
|
if self.state != S_FINISHED and connection == \
|
||||||
|
self.active_connection:
|
||||||
|
self.active_connection = None
|
||||||
|
self.state = S_INITIAL
|
||||||
|
self.try_next_connection()
|
||||||
|
|
||||||
def try_next_connection(self):
|
def try_next_connection(self):
|
||||||
''' try to resolve proxy with the next possible connection '''
|
''' try to resolve proxy with the next possible connection '''
|
||||||
|
@ -149,6 +156,7 @@ class ProxyResolver:
|
||||||
def __init__(self, proxy):
|
def __init__(self, proxy):
|
||||||
self.proxy = proxy
|
self.proxy = proxy
|
||||||
self.state = S_INITIAL
|
self.state = S_INITIAL
|
||||||
|
self.active_connection = None
|
||||||
self.connections = []
|
self.connections = []
|
||||||
self.host_tester = None
|
self.host_tester = None
|
||||||
self.jid = None
|
self.jid = None
|
||||||
|
|
Loading…
Reference in New Issue