From 8882c6b6fdb81ca207cdc9a481e18c79b34e7f95 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 28 Jun 2016 10:33:46 +0200 Subject: =?UTF-8?q?parse=20=C2=A75.1.2=20full=20jids=20from=20muc=20archiv?= =?UTF-8?q?es=20for=20OMEMO=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eu/siacs/conversations/parser/MessageParser.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 3f5a8366..ff66c30f 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -420,6 +420,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (message == null) { return; } + if (conversationMultiMode) { + message.setTrueCounterpart(origin); + } } else { message = new Message(conversation, body, Message.ENCRYPTION_NONE, status); } @@ -437,11 +440,16 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece message.markable = packet.hasChild("markable", "urn:xmpp:chat-markers:0"); if (conversationMultiMode) { final Jid fallback = conversation.getMucOptions().getTrueCounterpart(counterpart); - Jid trueCounterpart = getTrueCounterpart(query != null ? mucUserElement : null, fallback); + Jid trueCounterpart; + if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL) { + trueCounterpart = message.getTrueCounterpart(); + } else if (Config.PARSE_REAL_JID_FROM_MUC_MAM) { + trueCounterpart = getTrueCounterpart(query != null ? mucUserElement : null, fallback); + } else { + trueCounterpart = fallback; + } if (trueCounterpart != null && trueCounterpart.toBareJid().equals(account.getJid().toBareJid())) { status = isTypeGroupChat ? Message.STATUS_SEND_RECEIVED : Message.STATUS_SEND; - } else { - status = Message.STATUS_RECEIVED; } message.setStatus(status); message.setTrueCounterpart(trueCounterpart); @@ -638,7 +646,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece private static Jid getTrueCounterpart(Element mucUserElement, Jid fallback) { final Element item = mucUserElement == null ? null : mucUserElement.findChild("item"); Jid result = item == null ? null : item.getAttributeAsJid("jid"); - return result != null && Config.PARSE_REAL_JID_FROM_MUC_MAM ? result : fallback; + return result != null ? result : fallback; } private void sendMessageReceipts(Account account, MessagePacket packet) { -- cgit v1.2.3