only resume when disconnected not on purpose

This commit is contained in:
Jefry Lagrange 2011-06-11 16:29:08 -04:00
parent d73e277f40
commit 985746d65a
3 changed files with 8 additions and 6 deletions

View File

@ -776,6 +776,8 @@ class Connection(CommonConnection, ConnectionHandlers):
self.connected = 0 self.connected = 0
self.time_to_reconnect = None self.time_to_reconnect = None
self.privacy_rules_supported = False self.privacy_rules_supported = False
if on_purpose:
self.sm = Smacks(self)
if self.connection: if self.connection:
# make sure previous connection is completely closed # make sure previous connection is completely closed
gajim.proxy65_manager.disconnect(self.connection) gajim.proxy65_manager.disconnect(self.connection)

View File

@ -421,9 +421,9 @@ class XMPPDispatcher(PlugIn):
stanza.props = stanza.getProperties() stanza.props = stanza.getProperties()
ID = stanza.getID() ID = stanza.getID()
# If server supports stream management # If server supports stream management
if self.sm and self.sm.enabled and (stanza.getName() != 'r' or if self.sm and self.sm.enabled and (stanza.getName() != 'r' and
stanza.getName() != 'a' or stanza.getName() != 'a' and
stanza.getName() != 'enabled' or stanza.getName() != 'enabled' and
stanza.getName() != 'resumed'): stanza.getName() != 'resumed'):
# increments the number of stanzas that has been handled # increments the number of stanzas that has been handled
self.sm.in_h = self.sm.in_h + 1 self.sm.in_h = self.sm.in_h + 1

View File

@ -96,10 +96,10 @@ class Smacks():
if len(self.uqueue) < diff or diff < 0: if len(self.uqueue) < diff or diff < 0:
log.error('Server and client number of stanzas handled mismatch ') log.error('Server and client number of stanzas handled mismatch ')
return else:
while (len(self.uqueue) > diff): while (len(self.uqueue) > diff):
self.uqueue.pop(0) self.uqueue.pop(0)
if stanza.getName() == 'resumed': if stanza.getName() == 'resumed':