aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-09-29 11:57:16 +0200
committersteckbrief <steckbrief@chefmail.de>2016-09-29 11:57:16 +0200
commit34fcdda53fa8ae1174909b62860534d2d874eb72 (patch)
tree50564c1d946ef1779567c67ad25a646b446a6403 /src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
parent297bed106efdfa619d700ae44ce047d7f2663c93 (diff)
Implements FS#235: Deletion of remote files uploaded via httpupload
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java b/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
index 3facc14a..d9fc9584 100644
--- a/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
+++ b/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
@@ -18,6 +18,7 @@ import javax.net.ssl.SSLHandshakeException;
import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
+import de.thedevstack.conversationsplus.enums.FileStatus;
import de.thedevstack.conversationsplus.exceptions.RemoteFileNotFoundException;
import de.thedevstack.conversationsplus.utils.MessageUtil;
import de.thedevstack.conversationsplus.utils.StreamUtil;
@@ -74,11 +75,7 @@ public class HttpDownloadConnection implements Transferable {
this.message = message;
this.message.setTransferable(this);
try {
- if (message.hasFileOnRemoteHost()) {
- mUrl = message.getFileParams().url;
- } else {
- mUrl = new URL(message.getBody());
- }
+ mUrl = new URL(message.getFileParams().getUrl());
final String sUrlFilename = mUrl.getPath().substring(mUrl.getPath().lastIndexOf('/')).toLowerCase();
final String lastPart = FileUtils.getLastExtension(sUrlFilename);
@@ -131,6 +128,7 @@ public class HttpDownloadConnection implements Transferable {
private void finish() {
FileBackend.updateMediaScanner(file, mXmppConnectionService);
message.setTransferable(null);
+ MessageUtil.setAndSaveFileStatus(this.message, FileStatus.DOWNLOADED);
mHttpConnectionManager.finishConnection(this);
if (message.getEncryption() == Message.ENCRYPTION_PGP) {
message.getConversation().getAccount().getPgpDecryptionService().add(message);
@@ -176,7 +174,7 @@ public class HttpDownloadConnection implements Transferable {
HttpDownloadConnection.this.mXmppConnectionService.getNotificationService().push(message);
return;
} catch (RemoteFileNotFoundException e) {
- message.setNoDownloadable();
+ message.setNoDownloadable(); // TODO Set remote file status to not-available
cancel();
return;
} catch (IOException e) {