diff options
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r-- | src/eu/siacs/conversations/entities/Conversation.java | 23 | ||||
-rw-r--r-- | src/eu/siacs/conversations/entities/Message.java | 6 |
2 files changed, 15 insertions, 14 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; } diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index 8f9885c5..49482bbc 100644 --- a/src/eu/siacs/conversations/entities/Message.java +++ b/src/eu/siacs/conversations/entities/Message.java @@ -57,9 +57,9 @@ public class Message extends AbstractEntity { protected boolean read = true; protected String remoteMsgId = null; - protected transient Conversation conversation = null; - - protected transient Downloadable downloadable = null; + protected Conversation conversation = null; + protected Downloadable downloadable = null; + public boolean markable = false; private Message() { |