delete the connection when we go offline
This commit is contained in:
parent
637f35b279
commit
4b5e2381e1
|
@ -276,6 +276,7 @@ class connection:
|
||||||
if self.connection:
|
if self.connection:
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
self.dispatch('STATUS', 'offline')
|
self.dispatch('STATUS', 'offline')
|
||||||
|
self.connection = None
|
||||||
# END disconenctedCB
|
# END disconenctedCB
|
||||||
|
|
||||||
def _rosterSetCB(self, con, iq_obj):
|
def _rosterSetCB(self, con, iq_obj):
|
||||||
|
@ -378,7 +379,6 @@ class connection:
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
"""Connect and authentificate to the Jabber server"""
|
"""Connect and authentificate to the Jabber server"""
|
||||||
self.connected = 1
|
|
||||||
name = gajim.config.get_per('accounts', self.name, 'name')
|
name = gajim.config.get_per('accounts', self.name, 'name')
|
||||||
hostname = gajim.config.get_per('accounts', self.name, 'hostname')
|
hostname = gajim.config.get_per('accounts', self.name, 'hostname')
|
||||||
resource = gajim.config.get_per('accounts', self.name, 'resource')
|
resource = gajim.config.get_per('accounts', self.name, 'resource')
|
||||||
|
@ -386,6 +386,7 @@ class connection:
|
||||||
#create connexion if it doesn't already existe
|
#create connexion if it doesn't already existe
|
||||||
if self.connection:
|
if self.connection:
|
||||||
return self.connection
|
return self.connection
|
||||||
|
self.connected = 1
|
||||||
if gajim.config.get_per('accounts', self.name, 'use_proxy'):
|
if gajim.config.get_per('accounts', self.name, 'use_proxy'):
|
||||||
proxy = {'host': gajim.config.get_per('accounts', self.name, \
|
proxy = {'host': gajim.config.get_per('accounts', self.name, \
|
||||||
'proxyhost')}
|
'proxyhost')}
|
||||||
|
@ -505,6 +506,7 @@ class connection:
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
self.connection.disconnect(msg)
|
self.connection.disconnect(msg)
|
||||||
self.dispatch('STATUS', 'offline')
|
self.dispatch('STATUS', 'offline')
|
||||||
|
self.connection = None
|
||||||
elif status != 'offline' and self.connected:
|
elif status != 'offline' and self.connected:
|
||||||
self.connected = STATUS_LIST.index(status)
|
self.connected = STATUS_LIST.index(status)
|
||||||
ptype = 'available'
|
ptype = 'available'
|
||||||
|
@ -756,9 +758,9 @@ class connection:
|
||||||
iq.setID(id)
|
iq.setID(id)
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
def process(self):
|
def process(self, timeout):
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
return
|
return
|
||||||
if self.connected:
|
if self.connected:
|
||||||
self.connection.process(1)
|
self.connection.process(timeout)
|
||||||
# END GajimCore
|
# END GajimCore
|
||||||
|
|
|
@ -683,7 +683,7 @@ class interface:
|
||||||
def process_connections(self):
|
def process_connections(self):
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
if gajim.connections[account].connected:
|
if gajim.connections[account].connected:
|
||||||
gajim.connections[account].connection.process(0.01)
|
gajim.connections[account].process(0.01)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def save_config(self):
|
def save_config(self):
|
||||||
|
|
|
@ -698,7 +698,6 @@ class Roster_window:
|
||||||
if self.plugin.systray_enabled:
|
if self.plugin.systray_enabled:
|
||||||
self.plugin.systray.set_status('connecting')
|
self.plugin.systray.set_status('connecting')
|
||||||
|
|
||||||
save_pass = 0
|
|
||||||
save_pass = gajim.config.get_per('accounts', account, 'savepass')
|
save_pass = gajim.config.get_per('accounts', account, 'savepass')
|
||||||
if not save_pass and gajim.connections[account].connected < 2:
|
if not save_pass and gajim.connections[account].connected < 2:
|
||||||
passphrase = ''
|
passphrase = ''
|
||||||
|
|
Loading…
Reference in New Issue