From 522538e2acbc104346f8669e61cdb35731481837 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 13 Apr 2017 21:11:35 +0200 Subject: send urls pointing to pgp encrypted files directly in body+oob --- .../messenger/generator/MessageGenerator.java | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/main/java/de/pixart/messenger/generator') diff --git a/src/main/java/de/pixart/messenger/generator/MessageGenerator.java b/src/main/java/de/pixart/messenger/generator/MessageGenerator.java index 2155dc3c7..5ed2266ef 100644 --- a/src/main/java/de/pixart/messenger/generator/MessageGenerator.java +++ b/src/main/java/de/pixart/messenger/generator/MessageGenerator.java @@ -136,15 +136,22 @@ public class MessageGenerator extends AbstractGenerator { public MessagePacket generatePgpChat(Message message) { MessagePacket packet = preparePacket(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) { - packet.addChild("x", "jabber:x:encrypted").setContent(message.getBody()); + if (message.hasFileOnRemoteHost()) { + final String url = message.getFileParams().url.toString(); + packet.setBody(url); + packet.addChild("x", Namespace.OOB).addChild("url").setContent(url); + } else { + 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) { + packet.addChild("x", "jabber:x:encrypted").setContent(message.getBody()); + } + packet.addChild("encryption", "urn:xmpp:eme:0") + .setAttribute("namespace", "jabber:x:encrypted"); } - packet.addChild("encryption", "urn:xmpp:eme:0").setAttribute("namespace", "jabber:x:encrypted"); return packet; } -- cgit v1.2.3