include pgp and omemo fallback message only when unencrypted is enabled

This commit is contained in:
Daniel Gultsch 2016-07-14 16:06:05 +02:00
parent 223d50c1a0
commit 2803d342e1
1 changed files with 5 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
import eu.siacs.conversations.entities.Account;
@ -74,7 +75,7 @@ public class MessageGenerator extends AbstractGenerator {
return null;
}
packet.setAxolotlMessage(axolotlMessage.toElement());
if (!recipientSupportsOmemo(message)) {
if (Config.supportUnencrypted() && !recipientSupportsOmemo(message)) {
packet.setBody(OMEMO_FALLBACK_MESSAGE);
}
packet.addChild("store", "urn:xmpp:hints");
@ -130,7 +131,9 @@ public class MessageGenerator extends AbstractGenerator {
public MessagePacket generatePgpChat(Message message) {
MessagePacket packet = preparePacket(message);
packet.setBody(PGP_FALLBACK_MESSAGE);
if (Config.supportUnencrypted()) {
packet.setBody(PGP_FALLBACK_MESSAGE);
}
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
packet.addChild("x", "jabber:x:encrypted").setContent(message.getEncryptedBody());
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {