diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 76593e291..e0ae5fc04 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -597,8 +597,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece final boolean conversationIsProbablyMuc = isTypeGroupChat || mucUserElement != null || account.getXmppConnection().getMucServersWithholdAccount().contains(counterpart.getDomain().toEscapedString()); final boolean isOTR = body != null && body.content.startsWith("?OTR") && Config.supportOtr(); + final boolean correctOTR = !isForwarded && !isTypeGroupChat && isProperlyAddressed; - if ((conversationIsProbablyMuc && !isTypeGroupChat) || (!Strings.isNullOrEmpty(counterpart.getResource()) && isOTR)) { + if ((conversationIsProbablyMuc && !isTypeGroupChat) || (!Strings.isNullOrEmpty(counterpart.getResource()) && isOTR && correctOTR)) { nextCounterpart = counterpart; } @@ -663,17 +664,14 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } final Message message; if (isOTR) { - if (!isForwarded && !isTypeGroupChat && isProperlyAddressed && !conversationMultiMode) { + if (correctOTR && !conversationMultiMode) { message = parseOtrChat(body.content, from, remoteMsgId, conversation); if (message == null) { return; } } else { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignoring OTR message from " + from + " isForwarded=" + Boolean.toString(isForwarded) + ", isProperlyAddressed=" + Boolean.valueOf(isProperlyAddressed)); - message = new Message(conversation, body.content, Message.ENCRYPTION_NONE, status); - if (body.count > 1) { - message.setBodyLanguage(body.language); - } + message = null; } } else if (pgpEncrypted != null && Config.supportOpenPgp()) { message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status);