diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-28 10:33:46 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-06-28 10:33:46 +0200 |
commit | 8882c6b6fdb81ca207cdc9a481e18c79b34e7f95 (patch) | |
tree | 99ff2edc9728a3e51d71b4353d3477026928e060 | |
parent | e63d6b4bf2f17d82a2d7744c1efa13c46b043f5e (diff) |
parse ยง5.1.2 full jids from muc archives for OMEMO messages
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/MessageParser.java | 16 |
1 files 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) { |