hrukudah #15

Closed
bodqhrohro wants to merge 30 commits from hrukudah into master
Showing only changes of commit b18f042b8b - Show all commits

View file

@ -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 conversationIsProbablyMuc = isTypeGroupChat || mucUserElement != null || account.getXmppConnection().getMucServersWithholdAccount().contains(counterpart.getDomain().toEscapedString());
final boolean isOTR = body != null && body.content.startsWith("?OTR") && Config.supportOtr(); 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; nextCounterpart = counterpart;
} }
@ -663,17 +664,14 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
} }
final Message message; final Message message;
if (isOTR) { if (isOTR) {
if (!isForwarded && !isTypeGroupChat && isProperlyAddressed && !conversationMultiMode) { if (correctOTR && !conversationMultiMode) {
message = parseOtrChat(body.content, from, remoteMsgId, conversation); message = parseOtrChat(body.content, from, remoteMsgId, conversation);
if (message == null) { if (message == null) {
return; return;
} }
} else { } else {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignoring OTR message from " + from + " isForwarded=" + Boolean.toString(isForwarded) + ", isProperlyAddressed=" + Boolean.valueOf(isProperlyAddressed)); 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); message = null;
if (body.count > 1) {
message.setBodyLanguage(body.language);
}
} }
} else if (pgpEncrypted != null && Config.supportOpenPgp()) { } else if (pgpEncrypted != null && Config.supportOpenPgp()) {
message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status); message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status);