aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-08-27 19:25:58 +0200
committeriNPUTmice <daniel@gultsch.de>2014-08-30 09:22:16 +0200
commit4435b0055e9a8b8014a89f3bdec602b8106f992e (patch)
tree7b9824283a43853e8ff53e3e213c4fe24b0cb296 /src/eu/siacs
parent9075d3854dc8fd02a35bf628807b3982815ef7ad (diff)
reset unsend messages to waiting
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java17
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java2
2 files changed, 17 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 0e2054ebe..c949826ac 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -169,11 +169,11 @@ public class XmppConnectionService extends Service {
syncDirtyContacts(account);
scheduleWakeupCall(PING_MAX_INTERVAL, true);
} else if (account.getStatus() == Account.STATUS_OFFLINE) {
+ resetSendingToWaiting(account);
if (!account.isOptionSet(Account.OPTION_DISABLED)) {
int timeToReconnect = mRandom.nextInt(50) + 10;
scheduleWakeupCall(timeToReconnect, false);
}
-
} else if (account.getStatus() == Account.STATUS_REGISTRATION_SUCCESSFULL) {
databaseBackend.updateAccount(account);
reconnectAccount(account, true);
@@ -232,7 +232,8 @@ public class XmppConnectionService extends Service {
for (Conversation conversation : getConversations()) {
if (conversation.getAccount() == account) {
for (Message message : conversation.getMessages()) {
- if (message.getStatus() == Message.STATUS_UNSEND
+ if ((message.getStatus() == Message.STATUS_UNSEND || message
+ .getStatus() == Message.STATUS_WAITING)
&& message.getUuid().equals(uuid)) {
markMessage(message, Message.STATUS_SEND);
return;
@@ -1391,6 +1392,18 @@ public class XmppConnectionService extends Service {
MessagePacket packet = mMessageGenerator.invite(conversation, contact);
sendMessagePacket(conversation.getAccount(), packet);
}
+
+ public void resetSendingToWaiting(Account account) {
+ for(Conversation conversation : getConversations()) {
+ if (conversation.getAccount() == account) {
+ for(Message message : conversation.getMessages()) {
+ if (message.getStatus() == Message.STATUS_UNSEND) {
+ markMessage(message, Message.STATUS_WAITING);
+ }
+ }
+ }
+ }
+ }
public boolean markMessage(Account account, String recipient, String uuid,
int status) {
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index bc1cd7088..961611fd8 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -635,11 +635,13 @@ public class XmppConnection implements Runnable {
EnablePacket enable = new EnablePacket(smVersion);
tagWriter.writeStanzaAsync(enable);
stanzasSent = 0;
+ messageReceipts.clear();
} else if (streamFeatures.hasChild("sm", "urn:xmpp:sm:2")) {
smVersion = 2;
EnablePacket enable = new EnablePacket(smVersion);
tagWriter.writeStanzaAsync(enable);
stanzasSent = 0;
+ messageReceipts.clear();
}
sendServiceDiscoveryInfo(account.getServer());
sendServiceDiscoveryItems(account.getServer());