aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/http
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/http')
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java6
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java10
2 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
index 94a76837..3d8bba13 100644
--- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
+++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
@@ -17,11 +17,13 @@ import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLHandshakeException;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Transferable;
import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.entities.Message;
+import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.CryptoHelper;
@@ -81,7 +83,7 @@ public class HttpDownloadConnection implements Transferable {
extension = lastPart;
}
message.setRelativeFilePath(message.getUuid()+"."+extension);
- this.file = mXmppConnectionService.getFileBackend().getFile(message, false);
+ this.file = FileBackend.getFile(message, false);
String reference = mUrl.getRef();
if (reference != null && reference.length() == 96) {
this.file.setKey(CryptoHelper.hexToBytes(reference));
@@ -235,7 +237,7 @@ public class HttpDownloadConnection implements Transferable {
private void updateImageBounds() {
message.setType(Message.TYPE_FILE);
- mXmppConnectionService.getFileBackend().updateFileParams(message, mUrl);
+ FileBackend.updateFileParams(message, mUrl);
mXmppConnectionService.updateMessage(message);
}
diff --git a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java
index a3ab8dab..1fee4e58 100644
--- a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java
+++ b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java
@@ -12,6 +12,8 @@ import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
+import de.thedevstack.conversationsplus.utils.StreamUtil;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Transferable;
@@ -85,7 +87,7 @@ public class HttpUploadConnection implements Transferable {
message.setTransferable(this);
mXmppConnectionService.markMessage(message,Message.STATUS_UNSEND);
this.account = message.getConversation().getAccount();
- this.file = mXmppConnectionService.getFileBackend().getFile(message, false);
+ this.file = FileBackend.getFile(message, false);
this.file.setExpectedSize(this.file.getSize());
if (Config.ENCRYPT_ON_HTTP_UPLOADED) {
@@ -163,7 +165,7 @@ public class HttpUploadConnection implements Transferable {
if (key != null) {
mGetUrl = new URL(mGetUrl.toString() + "#" + CryptoHelper.bytesToHex(key));
}
- mXmppConnectionService.getFileBackend().updateFileParams(message, mGetUrl);
+ FileBackend.updateFileParams(message, mGetUrl);
message.setTransferable(null);
message.setCounterpart(message.getConversation().getJid().toBareJid());
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
@@ -193,8 +195,8 @@ public class HttpUploadConnection implements Transferable {
Log.d(Config.LOGTAG, e.getMessage());
fail();
} finally {
- FileBackend.close(is);
- FileBackend.close(os);
+ StreamUtil.close(is);
+ StreamUtil.close(os);
if (connection != null) {
connection.disconnect();
}