From 2803d342e1f008217aa6f003d917423b6e6e106b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 14 Jul 2016 16:06:05 +0200 Subject: include pgp and omemo fallback message only when unencrypted is enabled --- .../java/eu/siacs/conversations/generator/MessageGenerator.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java index cb06219f..5ef47a33 100644 --- a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java @@ -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) { -- cgit v1.2.3