diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-13 12:36:30 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-08-13 12:36:30 +0200 |
commit | 4736d12e999f9d5b4865f89682995e7439482ad2 (patch) | |
tree | 10952fdbb159501b9d82b10962ddbf722806912a | |
parent | eb8b6165d7c53bc8ed278c9f577d01900533850f (diff) |
make lastMessageTransmitted return max(clear_date,last_message)
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Conversation.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 56739f40..3c00fd59 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -803,19 +803,18 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl } public long getLastMessageTransmitted() { - long last_clear = getLastClearHistory(); - if (last_clear != 0) { - return last_clear; - } + final long last_clear = getLastClearHistory(); + long last_received = 0; synchronized (this.messages) { for(int i = this.messages.size() - 1; i >= 0; --i) { Message message = this.messages.get(i); if (message.getStatus() == Message.STATUS_RECEIVED || message.isCarbon()) { - return message.getTimeSent(); + last_received = message.getTimeSent(); + break; } } } - return 0; + return Math.max(last_clear,last_received); } public void setMutedTill(long value) { |