reset unsend messages to waiting
This commit is contained in:
parent
9075d3854d
commit
4435b0055e
|
@ -169,11 +169,11 @@ public class XmppConnectionService extends Service {
|
||||||
syncDirtyContacts(account);
|
syncDirtyContacts(account);
|
||||||
scheduleWakeupCall(PING_MAX_INTERVAL, true);
|
scheduleWakeupCall(PING_MAX_INTERVAL, true);
|
||||||
} else if (account.getStatus() == Account.STATUS_OFFLINE) {
|
} else if (account.getStatus() == Account.STATUS_OFFLINE) {
|
||||||
|
resetSendingToWaiting(account);
|
||||||
if (!account.isOptionSet(Account.OPTION_DISABLED)) {
|
if (!account.isOptionSet(Account.OPTION_DISABLED)) {
|
||||||
int timeToReconnect = mRandom.nextInt(50) + 10;
|
int timeToReconnect = mRandom.nextInt(50) + 10;
|
||||||
scheduleWakeupCall(timeToReconnect, false);
|
scheduleWakeupCall(timeToReconnect, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (account.getStatus() == Account.STATUS_REGISTRATION_SUCCESSFULL) {
|
} else if (account.getStatus() == Account.STATUS_REGISTRATION_SUCCESSFULL) {
|
||||||
databaseBackend.updateAccount(account);
|
databaseBackend.updateAccount(account);
|
||||||
reconnectAccount(account, true);
|
reconnectAccount(account, true);
|
||||||
|
@ -232,7 +232,8 @@ public class XmppConnectionService extends Service {
|
||||||
for (Conversation conversation : getConversations()) {
|
for (Conversation conversation : getConversations()) {
|
||||||
if (conversation.getAccount() == account) {
|
if (conversation.getAccount() == account) {
|
||||||
for (Message message : conversation.getMessages()) {
|
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)) {
|
&& message.getUuid().equals(uuid)) {
|
||||||
markMessage(message, Message.STATUS_SEND);
|
markMessage(message, Message.STATUS_SEND);
|
||||||
return;
|
return;
|
||||||
|
@ -1392,6 +1393,18 @@ public class XmppConnectionService extends Service {
|
||||||
sendMessagePacket(conversation.getAccount(), packet);
|
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,
|
public boolean markMessage(Account account, String recipient, String uuid,
|
||||||
int status) {
|
int status) {
|
||||||
for (Conversation conversation : getConversations()) {
|
for (Conversation conversation : getConversations()) {
|
||||||
|
|
|
@ -635,11 +635,13 @@ public class XmppConnection implements Runnable {
|
||||||
EnablePacket enable = new EnablePacket(smVersion);
|
EnablePacket enable = new EnablePacket(smVersion);
|
||||||
tagWriter.writeStanzaAsync(enable);
|
tagWriter.writeStanzaAsync(enable);
|
||||||
stanzasSent = 0;
|
stanzasSent = 0;
|
||||||
|
messageReceipts.clear();
|
||||||
} else if (streamFeatures.hasChild("sm", "urn:xmpp:sm:2")) {
|
} else if (streamFeatures.hasChild("sm", "urn:xmpp:sm:2")) {
|
||||||
smVersion = 2;
|
smVersion = 2;
|
||||||
EnablePacket enable = new EnablePacket(smVersion);
|
EnablePacket enable = new EnablePacket(smVersion);
|
||||||
tagWriter.writeStanzaAsync(enable);
|
tagWriter.writeStanzaAsync(enable);
|
||||||
stanzasSent = 0;
|
stanzasSent = 0;
|
||||||
|
messageReceipts.clear();
|
||||||
}
|
}
|
||||||
sendServiceDiscoveryInfo(account.getServer());
|
sendServiceDiscoveryInfo(account.getServer());
|
||||||
sendServiceDiscoveryItems(account.getServer());
|
sendServiceDiscoveryItems(account.getServer());
|
||||||
|
|
Loading…
Reference in a new issue