diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-04-19 20:14:04 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-04-19 20:14:04 +0200 |
commit | 4db32cdc8f44382c8768c4057851116cae07bf30 (patch) | |
tree | e67997fb658b9ca0faeb2dcf728dbb549f108712 /src/main/java/de/thedevstack | |
parent | ee0264d98c9a348ea29d12796bed25f9ba1494fb (diff) |
Related to FS#134: Set Message flags according to httpupload hint
Diffstat (limited to 'src/main/java/de/thedevstack')
3 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/Message.java b/src/main/java/de/thedevstack/conversationsplus/entities/Message.java index 0cb390e7..37147b31 100644 --- a/src/main/java/de/thedevstack/conversationsplus/entities/Message.java +++ b/src/main/java/de/thedevstack/conversationsplus/entities/Message.java @@ -537,6 +537,10 @@ public class Message extends AbstractEntity { mTreatAsDownloadAble = Decision.NEVER; } + public void setTreatAsDownloadable(Decision downloadable) { + this.mTreatAsDownloadAble = downloadable; + } + public Decision treatAsDownloadable() { // only test this ones, body will not change if (mTreatAsDownloadAble != Decision.NOT_DECIDED) { diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java b/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java index 6c546fee..da24f5ab 100644 --- a/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java +++ b/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java @@ -97,6 +97,8 @@ public class HttpUploadConnection implements Transferable { public void init(Message message, boolean delay) { this.message = message; + this.message.setHttpUploaded(true); + this.message.setNoDownloadable(); this.account = message.getConversation().getAccount(); this.file = FileBackend.getFile(message, false); this.mime = this.file.getMimeType(); diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java b/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java index 4e70ab65..a89adb23 100644 --- a/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java @@ -392,6 +392,9 @@ public class MessageParser extends AbstractParser implements serverMsgId = extractStanzaId(packet, isTypeGroupChat ? conversation.getJid().toBareJid() : account.getServer()); } message.setHttpUploaded(packet.hasChild(HttpUploadHint.ELEMENT_NAME, HttpUploadHint.NAMESPACE)); + if (message.isHttpUploaded()) { + message.setTreatAsDownloadable(Message.Decision.MUST); + } message.setCounterpart(counterpart); message.setRemoteMsgId(remoteMsgId); |