always include omemo fallback message

This commit is contained in:
Daniel Gultsch 2018-04-14 21:31:30 +02:00
parent fa13d2336e
commit 91a061f480

View file

@ -77,9 +77,7 @@ public class MessageGenerator extends AbstractGenerator {
return null; return null;
} }
packet.setAxolotlMessage(axolotlMessage.toElement()); packet.setAxolotlMessage(axolotlMessage.toElement());
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");
packet.addChild("encryption","urn:xmpp:eme:0") packet.addChild("encryption","urn:xmpp:eme:0")
.setAttribute("name","OMEMO") .setAttribute("name","OMEMO")
@ -96,11 +94,6 @@ public class MessageGenerator extends AbstractGenerator {
return packet; return packet;
} }
private static boolean recipientSupportsOmemo(Message message) {
Contact c = message.getContact();
return c != null && c.getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY);
}
public static void addMessageHints(MessagePacket packet) { public static void addMessageHints(MessagePacket packet) {
packet.addChild("private", "urn:xmpp:carbons:2"); packet.addChild("private", "urn:xmpp:carbons:2");
packet.addChild("no-copy", "urn:xmpp:hints"); packet.addChild("no-copy", "urn:xmpp:hints");