diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-28 10:33:46 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-06-28 14:01:40 +0200 |
commit | 1c620de83d6f501b2c6e75882cdd279f2f861dba (patch) | |
tree | 12929957bc65d0a2e11cf5414da0875454c55699 | |
parent | 67e0de4ec287d2b93d7f8f285df18f050785d95a (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 3f5a8366c..ff66c30f1 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) { |