include pgp and omemo fallback message only when unencrypted is enabled
This commit is contained in:
parent
223d50c1a0
commit
2803d342e1
|
@ -9,6 +9,7 @@ import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
||||||
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
|
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
@ -74,7 +75,7 @@ public class MessageGenerator extends AbstractGenerator {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
packet.setAxolotlMessage(axolotlMessage.toElement());
|
packet.setAxolotlMessage(axolotlMessage.toElement());
|
||||||
if (!recipientSupportsOmemo(message)) {
|
if (Config.supportUnencrypted() && !recipientSupportsOmemo(message)) {
|
||||||
packet.setBody(OMEMO_FALLBACK_MESSAGE);
|
packet.setBody(OMEMO_FALLBACK_MESSAGE);
|
||||||
}
|
}
|
||||||
packet.addChild("store", "urn:xmpp:hints");
|
packet.addChild("store", "urn:xmpp:hints");
|
||||||
|
@ -130,7 +131,9 @@ public class MessageGenerator extends AbstractGenerator {
|
||||||
|
|
||||||
public MessagePacket generatePgpChat(Message message) {
|
public MessagePacket generatePgpChat(Message message) {
|
||||||
MessagePacket packet = preparePacket(message);
|
MessagePacket packet = preparePacket(message);
|
||||||
packet.setBody(PGP_FALLBACK_MESSAGE);
|
if (Config.supportUnencrypted()) {
|
||||||
|
packet.setBody(PGP_FALLBACK_MESSAGE);
|
||||||
|
}
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
||||||
packet.addChild("x", "jabber:x:encrypted").setContent(message.getEncryptedBody());
|
packet.addChild("x", "jabber:x:encrypted").setContent(message.getEncryptedBody());
|
||||||
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {
|
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {
|
||||||
|
|
Loading…
Reference in a new issue