properly set stanza count on session resume
This commit is contained in:
parent
4a6a6c8403
commit
9075d3854d
|
@ -266,9 +266,27 @@ public class XmppConnection implements Runnable {
|
||||||
tagWriter.writeStanzaAsync(r);
|
tagWriter.writeStanzaAsync(r);
|
||||||
} else if (nextTag.isStart("resumed")) {
|
} else if (nextTag.isStart("resumed")) {
|
||||||
lastPaketReceived = SystemClock.elapsedRealtime();
|
lastPaketReceived = SystemClock.elapsedRealtime();
|
||||||
Log.d(LOGTAG, account.getJid() + ": session resumed");
|
Element resumed = tagReader.readElement(nextTag);
|
||||||
tagReader.readElement(nextTag);
|
String h = resumed.getAttribute("h");
|
||||||
sendPing();
|
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);
|
changeStatus(Account.STATUS_ONLINE);
|
||||||
} else if (nextTag.isStart("r")) {
|
} else if (nextTag.isStart("r")) {
|
||||||
tagReader.readElement(nextTag);
|
tagReader.readElement(nextTag);
|
||||||
|
|
Loading…
Reference in New Issue