diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-10-08 10:49:04 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-10-08 10:49:04 +0200 |
commit | 795a13c4db756e557902b4b94506716fdecf6f44 (patch) | |
tree | 88a513dd0dbb15d036c42161c0cc7548a49383c6 /src/main/java | |
parent | fd8f219e507c79c7c8623d34b8b878733b3864dc (diff) |
reset sending to waiting on every error
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 8 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 9e4f55c29..f5d730282 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -351,6 +351,7 @@ public class XmppConnectionService extends Service { reconnectAccount(account, true, false); } else if ((account.getStatus() != Account.State.CONNECTING) && (account.getStatus() != Account.State.NO_INTERNET)) { + resetSendingToWaiting(account); if (connection != null) { int next = connection.getTimeToNextAttempt(); Log.d(Config.LOGTAG, account.getJid().toBareJid() @@ -1433,6 +1434,13 @@ public class XmppConnectionService extends Service { for (Conversation conversation : conversations) { conversation.addAll(0, databaseBackend.getMessages(conversation, Config.PAGE_SIZE)); checkDeletedFiles(conversation); + conversation.findUnsentTextMessages(new Conversation.OnMessageFound() { + + @Override + public void onMessageFound(Message message) { + markMessage(message, Message.STATUS_WAITING); + } + }); conversation.findUnreadMessages(new Conversation.OnMessageFound() { @Override public void onMessageFound(Message message) { diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 55f258de5..05b691390 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -254,6 +254,9 @@ public class XmppConnection implements Runnable { } protected void connect() { + if (mXmppConnectionService.areMessagesInitialized()) { + mXmppConnectionService.resetSendingToWaiting(account); + } Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": connecting"); features.encryptionEnabled = false; this.attempt++; @@ -1091,7 +1094,6 @@ public class XmppConnection implements Runnable { mStanzaQueue.clear(); } } - mXmppConnectionService.resetSendingToWaiting(account); features.carbonsEnabled = false; features.blockListRequested = false; synchronized (this.disco) { |