From 0e4cf23bf1eb9a7cd5dfec8676d416e8215a726b Mon Sep 17 00:00:00 2001 From: steckbrief Date: Sat, 12 May 2018 22:32:48 +0200 Subject: fixes FS#265: set message status to transmitted if automatic download cannot be started --- .../filetransfer/http/download/AutomaticFileDownload.java | 9 ++++++--- 1 file 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 true if the file transfer was successful, false 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)) { -- cgit v1.2.3