resuming from prefered location

This commit is contained in:
Jefry Lagrange 2011-06-15 20:37:07 -04:00
parent e02088e91c
commit db7276752b
2 changed files with 15 additions and 3 deletions

View File

@ -996,8 +996,16 @@ class Connection(CommonConnection, ConnectionHandlers):
"""
if self.connection:
return self.connection, ''
if data:
if self.sm.resuming and self.sm.location:
# If resuming and server gave a location, connect from there
hostname = self.sm.location
self.try_connecting_for_foo_secs = gajim.config.get_per('accounts',
self.name, 'try_connecting_for_foo_secs')
use_custom = False
elif data:
hostname = data['hostname']
self.try_connecting_for_foo_secs = 45
p = data['proxy']

View File

@ -25,6 +25,7 @@ class Smacks():
self._owner = None
self.resuming = False
self.enabled = False # If SM is enabled
self.location = None
def set_owner(self, owner):
self._owner = owner
@ -51,7 +52,10 @@ class Smacks():
if r == 'false' or r == 'False' or r == '0':
self.negociate(False)
l = stanza.getAttr('location')
if l:
self.location = l
self.enabled = True
def negociate(self, resume=True):