From 61f353983979845b64e37f98c9a7c7ced2e92800 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 2 Dec 2017 17:48:54 +0100 Subject: [PATCH] MAM: do not use private messages when finding last id in muc --- .../java/eu/siacs/conversations/entities/Conversation.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index cce8a7468..c0af689a6 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;