diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-05-22 19:42:43 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-05-22 19:42:43 +0200 |
commit | ca34be385e8c1e414dab4b49080087dffa85f876 (patch) | |
tree | 97a0ceeeca0b2512919492317db8412becbef8fa /src/main/java/eu/siacs/conversations/entities | |
parent | 73a02abfd73da1ca5f5f9ed6c0c7c287371d0d25 (diff) | |
parent | abbdf232c6f27a00edaa9af5937f9d022ad15f65 (diff) |
Merge remote-tracking branch 'refs/remotes/siacs/master'
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Conversation.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index e29ebb52c..518152356 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -97,6 +97,21 @@ public class Conversation extends AbstractEntity implements Blockable { this.messagesLeftOnServer = value; } + + public Message getFirstUnreadMessage() { + Message first = null; + synchronized (this.messages) { + for (int i = messages.size() - 1; i >= 0; --i) { + if (messages.get(i).isRead()) { + return first; + } else { + first = messages.get(i); + } + } + } + return first; + } + public Message findUnsentMessageWithUuid(String uuid) { synchronized(this.messages) { for (final Message message : this.messages) { |