diff options
author | steckbrief <steckbrief@chefmail.de> | 2018-05-12 22:32:48 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2018-05-12 22:32:48 +0200 |
commit | 0e4cf23bf1eb9a7cd5dfec8676d416e8215a726b (patch) | |
tree | 2b2f96131bc5c312e26d7124a2a4ef4e7d855d0c | |
parent | bff97731deed4c599dcb6c3a2887c9f47165dd3f (diff) |
fixes FS#265: set message status to transmitted if automatic download cannot be started
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java index 4401fb06..f337f23a 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java @@ -4,8 +4,10 @@ import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; import de.thedevstack.conversationsplus.entities.Message; +import de.thedevstack.conversationsplus.enums.MessageStatus; import de.thedevstack.conversationsplus.http.HttpHeadRetrievedListener; import de.thedevstack.conversationsplus.services.filetransfer.FileTransferManager; +import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; /** @@ -15,8 +17,9 @@ public class AutomaticFileDownload implements HttpHeadRetrievedListener { @Override public void onFileSizeRetrieved(long size, Message message) { - if (!this.transferFile(message)) { - + if (!this.transferFile(message)) { // file cannot be auto downloaded - but message is successfully received + Logging.d("http-download", "No automatic download started - but message was transmitted"); + MessageUtil.setAndSaveMessageStatus(message, MessageStatus.TRANSMITTED); } } @@ -27,7 +30,7 @@ public class AutomaticFileDownload implements HttpHeadRetrievedListener { * @return <code>true</code> if the file transfer was successful, <code>false</code> otherwise */ public boolean transferFile(Message message) { - if (this.accept(message)) { + if (this.accept(message)) { // link or attached file can be auto downloaded Logging.d("http-download", "Starting automatic download"); FileTransferManager ftm = FileTransferManager.getInstance(); if (ftm.accept(message)) { |