aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities/Conversation.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/entities/Conversation.java')
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index 39e54a8f..60afaa5d 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -68,7 +68,7 @@ public class Conversation extends AbstractEntity {
private transient MucOptions mucOptions = null;
- private transient String latestMarkableMessageId;
+ //private transient String latestMarkableMessageId;
private byte[] symmetricKey;
@@ -138,10 +138,17 @@ public class Conversation extends AbstractEntity {
}
}
- public String popLatestMarkableMessageId() {
- String id = this.latestMarkableMessageId;
- this.latestMarkableMessageId = null;
- return id;
+ public String getLatestMarkableMessageId() {
+ for(int i = this.messages.size() - 1; i >= 0; --i) {
+ if (this.messages.get(i).getStatus() <= Message.STATUS_RECEIVED && this.messages.get(i).markable) {
+ if (this.messages.get(i).isRead()) {
+ return null;
+ } else {
+ return this.messages.get(i).getRemoteMsgId();
+ }
+ }
+ }
+ return null;
}
public Message getLatestMessage() {
@@ -405,12 +412,6 @@ public class Conversation extends AbstractEntity {
this.nextMessage = message;
}
- public void setLatestMarkableMessageId(String id) {
- if (id != null) {
- this.latestMarkableMessageId = id;
- }
- }
-
public void setSymmetricKey(byte[] key) {
this.symmetricKey = key;
}