avoided unecessary message searchs

This commit is contained in:
iNPUTmice 2014-10-02 18:54:21 +02:00
parent f8be57d43f
commit cc76e15b95

View File

@ -1533,26 +1533,34 @@ public class XmppConnectionService extends Service {
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()) { if (uuid == null) {
if (conversation.getContactJid().equals(recipient) return false;
&& conversation.getAccount().equals(account)) { } else {
return markMessage(conversation, uuid, status); for (Conversation conversation : getConversations()) {
if (conversation.getContactJid().equals(recipient)
&& conversation.getAccount().equals(account)) {
return markMessage(conversation, uuid, status);
}
} }
return false;
} }
return false;
} }
public boolean markMessage(Conversation conversation, String uuid, public boolean markMessage(Conversation conversation, String uuid,
int status) { int status) {
for (Message message : conversation.getMessages()) { if (uuid == null) {
if (message.getUuid().equals(uuid) return false;
|| (message.getStatus() >= Message.STATUS_SEND && uuid } else {
.equals(message.getRemoteMsgId()))) { for (Message message : conversation.getMessages()) {
markMessage(message, status); if (uuid.equals(message.getUuid())
return true; || (message.getStatus() >= Message.STATUS_SEND && uuid
.equals(message.getRemoteMsgId()))) {
markMessage(message, status);
return true;
}
} }
return false;
} }
return false;
} }
public void markMessage(Message message, int status) { public void markMessage(Message message, int status) {