reset sending to waiting on every error

This commit is contained in:
Daniel Gultsch 2016-10-07 14:54:35 +02:00
parent 5a73a6b139
commit 9efef24a04
2 changed files with 11 additions and 2 deletions

View File

@ -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() {

View File

@ -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) {