diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-10-07 14:54:35 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-10-07 14:54:35 +0200 |
commit | 9efef24a04d3ba9802bef191e6b7dc739785ebad (patch) | |
tree | 191664325c5480145f303e40d51f68668ec0668d /src/main/java/eu | |
parent | 5a73a6b139acbead1771f3a62e1a577c220ca98e (diff) |
reset sending to waiting on every error
Diffstat (limited to 'src/main/java/eu')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 9 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index e8b13dde..f6298ea2 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -343,6 +343,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() @@ -1312,6 +1313,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) { @@ -2894,7 +2902,6 @@ public class XmppConnectionService extends Service { } public void resetSendingToWaiting(Account account) { - Log.d(Config.LOGTAG,account.getJid().toBareJid()+": reset 'sending' messages to 'waiting'"); for (Conversation conversation : getConversations()) { if (conversation.getAccount() == account) { conversation.findUnsentTextMessages(new Conversation.OnMessageFound() { diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index c8f98a34..ab92535a 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -244,6 +244,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++; @@ -1069,7 +1072,6 @@ public class XmppConnection implements Runnable { mStanzaQueue.clear(); } } - mXmppConnectionService.resetSendingToWaiting(account); features.carbonsEnabled = false; features.blockListRequested = false; synchronized (this.disco) { |