simulate old behaviour with messages being set to waiting while offline

This commit is contained in:
Daniel Gultsch 2015-08-19 13:00:52 +02:00
parent c9b2638778
commit 9e26375d2f
2 changed files with 10 additions and 3 deletions

View file

@ -149,7 +149,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
@Override @Override
public void onBind(final Account account) { public void onBind(final Account account) {
resetSendingToWaiting(account);
account.getRoster().clearPresences(); account.getRoster().clearPresences();
fetchRosterFromServer(account); fetchRosterFromServer(account);
fetchBookmarks(account); fetchBookmarks(account);

View file

@ -49,6 +49,7 @@ import eu.siacs.conversations.crypto.sasl.Plain;
import eu.siacs.conversations.crypto.sasl.SaslMechanism; import eu.siacs.conversations.crypto.sasl.SaslMechanism;
import eu.siacs.conversations.crypto.sasl.ScramSha1; import eu.siacs.conversations.crypto.sasl.ScramSha1;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.generator.IqGenerator; import eu.siacs.conversations.generator.IqGenerator;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
@ -316,7 +317,7 @@ public class XmppConnection implements Runnable {
+ ") enabled (resumable)"); + ") enabled (resumable)");
} else { } else {
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": stream managment(" + smVersion + ") enabled"); + ": stream management(" + smVersion + ") enabled");
} }
this.lastSessionStarted = SystemClock.elapsedRealtime(); this.lastSessionStarted = SystemClock.elapsedRealtime();
this.stanzasReceived = 0; this.stanzasReceived = 0;
@ -343,6 +344,13 @@ public class XmppConnection implements Runnable {
mStanzaQueue.clear(); mStanzaQueue.clear();
Log.d(Config.LOGTAG,"resending "+failedStanzas.size()+" stanzas"); Log.d(Config.LOGTAG,"resending "+failedStanzas.size()+" stanzas");
for(AbstractAcknowledgeableStanza packet : failedStanzas) { for(AbstractAcknowledgeableStanza packet : failedStanzas) {
if (packet instanceof MessagePacket) {
MessagePacket message = (MessagePacket) packet;
mXmppConnectionService.markMessage(account,
message.getTo().toBareJid(),
message.getId(),
Message.STATUS_UNSEND);
}
sendPacket(packet); sendPacket(packet);
} }
} catch (final NumberFormatException ignored) { } catch (final NumberFormatException ignored) {
@ -764,7 +772,7 @@ public class XmppConnection implements Runnable {
sendServiceDiscoveryInfo(account.getServer()); sendServiceDiscoveryInfo(account.getServer());
sendServiceDiscoveryInfo(account.getJid().toBareJid()); sendServiceDiscoveryInfo(account.getJid().toBareJid());
sendServiceDiscoveryItems(account.getServer()); sendServiceDiscoveryItems(account.getServer());
Log.d(Config.LOGTAG, account.getJid().toBareJid()+ ": online with resource " + account.getResource()); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": online with resource " + account.getResource());
changeStatus(Account.State.ONLINE); changeStatus(Account.State.ONLINE);
if (bindListener != null) { if (bindListener != null) {
bindListener.onBind(account); bindListener.onBind(account);