From 53241f2ef1e01aeb122c8ae10a0744de1e247a68 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 26 Jan 2017 19:19:08 +0100 Subject: add explicit encryption hints to outgoing messages --- src/main/java/eu/siacs/conversations/crypto/OtrService.java | 3 ++- .../java/eu/siacs/conversations/generator/MessageGenerator.java | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/crypto/OtrService.java b/src/main/java/eu/siacs/conversations/crypto/OtrService.java index 3663cd3b..55f4ebb5 100644 --- a/src/main/java/eu/siacs/conversations/crypto/OtrService.java +++ b/src/main/java/eu/siacs/conversations/crypto/OtrService.java @@ -194,8 +194,9 @@ public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost { } catch (final InvalidJidException ignored) { } - packet.setType(MessagePacket.TYPE_CHAT); + packet.addChild("encryption","urn:xmpp:eme:0") + .setAttribute("namespace","urn:xmpp:otr:0"); account.getXmppConnection().sendMessagePacket(packet); } diff --git a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java index f5c701cc..d0c20ad5 100644 --- a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java @@ -79,6 +79,9 @@ public class MessageGenerator extends AbstractGenerator { packet.setBody(OMEMO_FALLBACK_MESSAGE); } packet.addChild("store", "urn:xmpp:hints"); + packet.addChild("encryption","urn:xmpp:eme:0") + .setAttribute("name","OMEMO") + .setAttribute("namespace",AxolotlService.PEP_PREFIX); return packet; } @@ -109,6 +112,8 @@ public class MessageGenerator extends AbstractGenerator { content = message.getBody(); } packet.setBody(otrSession.transformSending(content)[0]); + packet.addChild("encryption","urn:xmpp:eme:0") + .setAttribute("namespace","urn:xmpp:otr:0"); return packet; } catch (OtrException e) { return null; @@ -139,6 +144,8 @@ public class MessageGenerator extends AbstractGenerator { } else if (message.getEncryption() == Message.ENCRYPTION_PGP) { packet.addChild("x", "jabber:x:encrypted").setContent(message.getBody()); } + packet.addChild("encryption","urn:xmpp:eme:0") + .setAttribute("namespace","jabber:x:encrypted"); return packet; } -- cgit v1.2.3