aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/generator
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-04-13 21:11:35 +0200
committerChristian Schneppe <christian@pix-art.de>2017-04-13 21:11:35 +0200
commit522538e2acbc104346f8669e61cdb35731481837 (patch)
tree7c4444511f2053b67be58b628ff11f4b88e8ccf8 /src/main/java/de/pixart/messenger/generator
parent09d7b611af577fb920f032521cc8f1603cb5ec40 (diff)
send urls pointing to pgp encrypted files directly in body+oob
Diffstat (limited to 'src/main/java/de/pixart/messenger/generator')
-rw-r--r--src/main/java/de/pixart/messenger/generator/MessageGenerator.java23
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;
}