aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/xmpp
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-21 15:05:26 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-21 15:05:26 +0100
commit2f7a141ee68789175b59a39f4b62dbc8c691a1e3 (patch)
tree0c8f020f005e707d644160e4f7bdd3443680943a /src/main/java/de/pixart/messenger/xmpp
parent701c454e3f76293e1c27cc41baec73fc549dad9f (diff)
postpone notification actions (mark as read, reply) until after messages are loaded
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 0e168ca3b..f015544ed 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -1073,14 +1073,16 @@ public class XmppConnection implements Runnable {
}
private void sendBindRequest() {
- while (!mXmppConnectionService.areMessagesInitialized() && socket != null && !socket.isClosed()) {
- uninterruptedSleep(500);
+ try {
+ mXmppConnectionService.restoredFromDatabaseLatch.await();
+ } catch (InterruptedException e) {
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": interrupted while waiting for DB restore during bind");
+ return;
}
needsBinding = false;
clearIqCallbacks();
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
- iq.addChild("bind", "urn:ietf:params:xml:ns:xmpp-bind")
- .addChild("resource").setContent(account.getResource());
+ iq.addChild("bind", Namespace.BIND).addChild("resource").setContent(account.getResource());
this.sendUnmodifiedIqPacket(iq, new OnIqPacketReceived() {
@Override
public void onIqPacketReceived(final Account account, final IqPacket packet) {