aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-12-02 17:48:54 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-12-02 17:48:54 +0100
commit61f353983979845b64e37f98c9a7c7ced2e92800 (patch)
tree53cbff0b8a92f1871bb2d59831ec02f4f56e4a43
parent97df4a682bd36acd71ac16f2d5d149a797ec61c9 (diff)
MAM: do not use private messages when finding last id in muc
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index cce8a74..c0af689 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -840,7 +840,10 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
MamReference lastReceived = new MamReference(0);
synchronized (this.messages) {
for(int i = this.messages.size() - 1; i >= 0; --i) {
- Message message = this.messages.get(i);
+ final Message message = this.messages.get(i);
+ if (message.getType() == Message.TYPE_PRIVATE) {
+ continue; //it's unsafe to use private messages as anchor. They could be coming from user archive
+ }
if (message.getStatus() == Message.STATUS_RECEIVED || message.isCarbon() || message.getServerMsgId() != null) {
lastReceived = new MamReference(message.getTimeSent(),message.getServerMsgId());
break;