be more restrictive about marking messages as sent_received in muc parser

This commit is contained in:
Daniel Gultsch 2015-08-26 12:11:12 +02:00
parent 3e0636367a
commit ea2ce78d6e
2 changed files with 18 additions and 8 deletions

View file

@ -201,12 +201,23 @@ public class Conversation extends AbstractEntity implements Blockable {
} }
} }
public Message findSentMessageWithUuid(String uuid) { public Message findSentMessageWithUuidOrRemoteId(String id) {
synchronized (this.messages) { synchronized (this.messages) {
for (Message message : this.messages) { for (Message message : this.messages) {
if (uuid.equals(message.getUuid()) if (id.equals(message.getUuid())
|| (message.getStatus() >= Message.STATUS_SEND && uuid || (message.getStatus() >= Message.STATUS_SEND
.equals(message.getRemoteMsgId()))) { && id.equals(message.getRemoteMsgId()))) {
return message;
}
}
}
return null;
}
public Message findSentMessageWithUuid(String id) {
synchronized (this.messages) {
for (Message message : this.messages) {
if (id.equals(message.getUuid())) {
return message; return message;
} }
} }

View file

@ -2216,7 +2216,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
} }
for (Conversation conversation : getConversations()) { for (Conversation conversation : getConversations()) {
if (conversation.getJid().toBareJid().equals(recipient) && conversation.getAccount() == account) { if (conversation.getJid().toBareJid().equals(recipient) && conversation.getAccount() == account) {
final Message message = conversation.findSentMessageWithUuid(uuid); final Message message = conversation.findSentMessageWithUuidOrRemoteId(uuid);
if (message != null) { if (message != null) {
markMessage(message, status); markMessage(message, status);
} }
@ -2226,8 +2226,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
return null; return null;
} }
public boolean markMessage(Conversation conversation, String uuid, public boolean markMessage(Conversation conversation, String uuid, int status) {
int status) {
if (uuid == null) { if (uuid == null) {
return false; return false;
} else { } else {