diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/parser')
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/MessageParser.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index 90bff0e1a..b621ef79b 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -371,8 +371,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece final Element mucUserElement = packet.findChild("x", "http://jabber.org/protocol/muc#user"); final String pgpEncrypted = packet.findChildContent("x", "jabber:x:encrypted"); final Element replaceElement = packet.findChild("replace", "urn:xmpp:message-correct:0"); - final Element oob = packet.findChild("x", "jabber:x:oob"); - final boolean isOob = oob != null && body != null && body.equals(oob.findChildContent("url")); + final Element oob = packet.findChild("x", Namespace.OOB); + final String oobUrl = oob != null ? oob.findChildContent("url") : null; final String replacementId = replaceElement == null ? null : replaceElement.getAttribute("id"); final Element axolotlEncrypted = packet.findChild(XmppAxolotlMessage.CONTAINERTAG, AxolotlService.PEP_PREFIX); int status; @@ -413,7 +413,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece mXmppConnectionService.updateConversationUi(); } - if ((body != null || pgpEncrypted != null || axolotlEncrypted != null) && !isMucStatusMessage) { + if ((body != null || pgpEncrypted != null || axolotlEncrypted != null || oobUrl != null) && !isMucStatusMessage) { Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, false, query); final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI; if (serverMsgId == null) { @@ -468,6 +468,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (conversationMultiMode) { message.setTrueCounterpart(origin); } + } else if (body == null && oobUrl != null) { + message = new Message(conversation, oobUrl, Message.ENCRYPTION_NONE, status); + message.setOob(true); } else { message = new Message(conversation, body, Message.ENCRYPTION_NONE, status); } @@ -477,7 +480,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece message.setServerMsgId(serverMsgId); message.setCarbon(isCarbon); message.setTime(timestamp); - message.setOob(isOob); + message.setOob(body != null && body.equals(oobUrl)); message.markable = packet.hasChild("markable", "urn:xmpp:chat-markers:0"); if (conversationMultiMode) { final Jid fallback = conversation.getMucOptions().getTrueCounterpart(counterpart); |