diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-09-29 11:57:16 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-09-29 11:57:16 +0200 |
commit | 34fcdda53fa8ae1174909b62860534d2d874eb72 (patch) | |
tree | 50564c1d946ef1779567c67ad25a646b446a6403 /src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java | |
parent | 297bed106efdfa619d700ae44ce047d7f2663c93 (diff) |
Implements FS#235: Deletion of remote files uploaded via httpupload
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java b/src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java index 5a1d6f3f..678f2c75 100644 --- a/src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java +++ b/src/main/java/de/thedevstack/conversationsplus/generator/MessageGenerator.java @@ -13,6 +13,7 @@ import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlMessage; import de.thedevstack.conversationsplus.entities.Account; import de.thedevstack.conversationsplus.entities.Conversation; +import de.thedevstack.conversationsplus.entities.FileParams; import de.thedevstack.conversationsplus.entities.Message; import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.chatstate.ChatState; @@ -70,13 +71,13 @@ public class MessageGenerator extends AbstractGenerator { return packet; } - public static void addXhtmlImImage(MessagePacket packet, Message.FileParams params) { + public static void addXhtmlImImage(MessagePacket packet, FileParams params) { Element html = packet.addChild("html", "http://jabber.org/protocol/xhtml-im"); Element body = html.addChild("body", "http://www.w3.org/1999/xhtml"); Element img = body.addChild("img"); - img.setAttribute("src", params.url.toString()); - img.setAttribute("height", params.height); - img.setAttribute("width", params.width); + img.setAttribute("src", params.getUrl()); + img.setAttribute("height", params.getHeight()); + img.setAttribute("width", params.getWidth()); } public static void addMessageHints(MessagePacket packet) { @@ -94,12 +95,7 @@ public class MessageGenerator extends AbstractGenerator { MessagePacket packet = preparePacket(message); addMessageHints(packet); try { - String content; - if (message.hasFileOnRemoteHost()) { - content = message.getFileParams().url.toString(); - } else { - content = message.getBody(); - } + String content = message.getBody(); packet.setBody(otrSession.transformSending(content)[0]); return packet; } catch (OtrException e) { @@ -111,14 +107,14 @@ public class MessageGenerator extends AbstractGenerator { MessagePacket packet = preparePacket(message); String content; if (message.hasFileOnRemoteHost()) { - Message.FileParams fileParams = message.getFileParams(); - content = fileParams.url.toString(); + FileParams fileParams = message.getFileParams(); + content = message.getBody(); if (message.isHttpUploaded()) { packet.addChild(new HttpUploadHint()); } packet.addChild("x","jabber:x:oob").addChild("url").setContent(content); - if (fileParams.width > 0 && fileParams.height > 0) { - addXhtmlImImage(packet,fileParams); + if (fileParams.getWidth() > 0 && fileParams.getHeight() > 0) { + addXhtmlImImage(packet, fileParams); } } else { content = message.getBody(); |