diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-08-27 14:51:00 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-08-30 09:22:16 +0200 |
commit | 9075d3854dc8fd02a35bf628807b3982815ef7ad (patch) | |
tree | 7f080a446e4db8cf33aa0d8b92739dca5fb92ad3 /src/eu/siacs/conversations | |
parent | 4a6a6c84031585ec7985fa16cbc86988d58e8b43 (diff) |
properly set stanza count on session resume
Diffstat (limited to 'src/eu/siacs/conversations')
-rw-r--r-- | src/eu/siacs/conversations/xmpp/XmppConnection.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 378e7d62..bc1cd708 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -266,9 +266,27 @@ public class XmppConnection implements Runnable { tagWriter.writeStanzaAsync(r); } else if (nextTag.isStart("resumed")) { lastPaketReceived = SystemClock.elapsedRealtime(); - Log.d(LOGTAG, account.getJid() + ": session resumed"); - tagReader.readElement(nextTag); - sendPing(); + Element resumed = tagReader.readElement(nextTag); + String h = resumed.getAttribute("h"); + try { + int serverCount = Integer.parseInt(h); + if (serverCount!=stanzasSent) { + Log.d(LOGTAG,account.getJid() + ": session resumed with lost packages"); + stanzasSent = serverCount; + } else { + Log.d(LOGTAG, account.getJid() + ": session resumed"); + } + if (acknowledgedListener!=null) { + for(int i = 0; i < messageReceipts.size(); ++i) { + if (serverCount>=messageReceipts.keyAt(i)) { + acknowledgedListener.onMessageAcknowledged(account, messageReceipts.valueAt(i)); + } + } + } + messageReceipts.clear(); + } catch (NumberFormatException e) { + + } changeStatus(Account.STATUS_ONLINE); } else if (nextTag.isStart("r")) { tagReader.readElement(nextTag); |