diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/generator/MessageGenerator.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/generator/MessageGenerator.java | 23 |
1 files changed, 15 insertions, 8 deletions
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; } |