aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authorDaniel Gultsch <inputmice@siacs.eu>2015-03-02 11:53:15 +0100
committerDaniel Gultsch <inputmice@siacs.eu>2015-03-02 11:53:15 +0100
commitac577fe4fd36e56ff492d588af5bb427b98d915e (patch)
tree6a7ee4578d5ab57089a1114c1ba8c6315a40e7c3 /src/main/java/eu/siacs/conversations/entities
parentff86fa604903cd77fe26860be0cc256b5d1e04eb (diff)
added methods to count number of unread messages
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java13
1 files changed, 13 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 1feb04c7..99823e4e 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -736,6 +736,19 @@ public class Conversation extends AbstractEntity implements Blockable {
}
}
+ public int unreadCount() {
+ synchronized (this.messages) {
+ int count = 0;
+ for(int i = this.messages.size() - 1; i >= 0; --i) {
+ if (this.messages.get(i).isRead()) {
+ return count;
+ }
+ ++count;
+ }
+ return count;
+ }
+ }
+
public class Smp {
public static final int STATUS_NONE = 0;
public static final int STATUS_CONTACT_REQUESTED = 1;