From 985746d65a4152dc006ffcda85b4ea0c74b5f8ea Mon Sep 17 00:00:00 2001 From: Jefry Lagrange Date: Sat, 11 Jun 2011 16:29:08 -0400 Subject: [PATCH] only resume when disconnected not on purpose --- src/common/connection.py | 2 ++ src/common/xmpp/dispatcher_nb.py | 6 +++--- src/common/xmpp/smacks.py | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index e5ac4b86d..9913cf737 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -776,6 +776,8 @@ class Connection(CommonConnection, ConnectionHandlers): self.connected = 0 self.time_to_reconnect = None self.privacy_rules_supported = False + if on_purpose: + self.sm = Smacks(self) if self.connection: # make sure previous connection is completely closed gajim.proxy65_manager.disconnect(self.connection) diff --git a/src/common/xmpp/dispatcher_nb.py b/src/common/xmpp/dispatcher_nb.py index 0f84c196a..c3174c615 100644 --- a/src/common/xmpp/dispatcher_nb.py +++ b/src/common/xmpp/dispatcher_nb.py @@ -421,9 +421,9 @@ class XMPPDispatcher(PlugIn): stanza.props = stanza.getProperties() ID = stanza.getID() # If server supports stream management - if self.sm and self.sm.enabled and (stanza.getName() != 'r' or - stanza.getName() != 'a' or - stanza.getName() != 'enabled' or + if self.sm and self.sm.enabled and (stanza.getName() != 'r' and + stanza.getName() != 'a' and + stanza.getName() != 'enabled' and stanza.getName() != 'resumed'): # increments the number of stanzas that has been handled self.sm.in_h = self.sm.in_h + 1 diff --git a/src/common/xmpp/smacks.py b/src/common/xmpp/smacks.py index 182ef0074..b4e2ed46f 100644 --- a/src/common/xmpp/smacks.py +++ b/src/common/xmpp/smacks.py @@ -96,10 +96,10 @@ class Smacks(): if len(self.uqueue) < diff or diff < 0: log.error('Server and client number of stanzas handled mismatch ') - return + else: - while (len(self.uqueue) > diff): - self.uqueue.pop(0) + while (len(self.uqueue) > diff): + self.uqueue.pop(0) if stanza.getName() == 'resumed':