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) {
for (Message message : this.messages) {
if (uuid.equals(message.getUuid())
|| (message.getStatus() >= Message.STATUS_SEND && uuid
.equals(message.getRemoteMsgId()))) {
if (id.equals(message.getUuid())
|| (message.getStatus() >= Message.STATUS_SEND
&& 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;
}
}

View File

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