diff options
Diffstat (limited to 'src')
-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); |