changeset 89e56f029296 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=89e56f029296 description: minor changes
diffstat:
src/common/xmpp/smacks.py | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
diffs (42 lines):
diff -r 7868d2ebc85f -r 89e56f029296 src/common/xmpp/smacks.py --- a/src/common/xmpp/smacks.py Tue May 31 17:09:49 2011 -0400 +++ b/src/common/xmpp/smacks.py Tue May 31 18:03:28 2011 -0400 @@ -18,6 +18,8 @@ self.out_h = 0 # Outgoing stanzas handled self.in_h = 0 # Incoming stanzas handled self.uqueue = [] # Unhandled stanzas queue + self.sesion_id = None + self.supports_resume = False # If server supports resume # Max number of stanzas in queue before making a request self.max_queue = 5 # Register handlers @@ -32,11 +34,15 @@
def negociate(self): stanza = Acks() - stanza.buildEnable() - self._owner.Connection.send(stanza, True) + stanza.buildEnable(resume=True) + self._owner.Connection.send(stanza, now=True)
def _neg_response(self, disp, stanza): - pass + r = stanza.getAttr('resume') + if r == 'true': + self.supports_resume = True + self.sesion_id = stanza.getAttr(id) +
def send_ack(self, disp, stanza): ack = Acks() @@ -49,6 +55,10 @@ self._owner.Connection.send(r, False)
def check_ack(self, disp, stanza): + ''' Checks if the number of stanzas sent are the same as the + number of stanzas received by the server. Pops stanzas that were + handled by the server from the queue. + ''' h = int(stanza.getAttr('h')) diff = self.out_h - h