OTR & another.im #23

Merged
Sergei Poljanski merged 65 commits from develop into master 2024-12-09 18:42:00 +00:00
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 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);