diff options
author | Daniel Gultsch <inputmice@siacs.eu> | 2015-01-11 22:18:18 +0100 |
---|---|---|
committer | Daniel Gultsch <inputmice@siacs.eu> | 2015-01-11 22:18:18 +0100 |
commit | ef6e4c5dd5e601f6a3c9e4e755fb31537a8cd56e (patch) | |
tree | ac196e72b9b7ca043695f7bdd99f55d8743b5f51 /src | |
parent | b07b7519a6bf382be809b8d33b801080a1616c8f (diff) |
do not check image file size over http if accepted file size is 0
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/PgpEngine.java | 9 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/MessageParser.java | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java index 83d9b7b2e..ad5a41323 100644 --- a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java +++ b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java @@ -19,6 +19,7 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.DownloadableFile; import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.http.HttpConnectionManager; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.ui.UiCallback; import android.app.PendingIntent; @@ -56,9 +57,11 @@ public class PgpEngine { if (message.getEncryption() == Message.ENCRYPTION_PGP) { message.setBody(os.toString()); message.setEncryption(Message.ENCRYPTION_DECRYPTED); - if (message.trusted() && message.bodyContainsDownloadable()) { - mXmppConnectionService.getHttpConnectionManager() - .createNewConnection(message); + final HttpConnectionManager manager = mXmppConnectionService.getHttpConnectionManager(); + if (message.trusted() + && message.bodyContainsDownloadable() + && manager.getAutoAcceptFileSize() > 0) { + manager.createNewConnection(message); } callback.success(message); } diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index bb9de0619..a15be622e 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -8,6 +8,8 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.MucOptions; +import eu.siacs.conversations.http.HttpConnection; +import eu.siacs.conversations.http.HttpConnectionManager; import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.CryptoHelper; @@ -575,9 +577,9 @@ public class MessageParser extends AbstractParser implements mXmppConnectionService.databaseBackend.createMessage(message); } } - if (message.trusted() && message.bodyContainsDownloadable()) { - this.mXmppConnectionService.getHttpConnectionManager() - .createNewConnection(message); + final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager(); + if (message.trusted() && message.bodyContainsDownloadable() && manager.getAutoAcceptFileSize() > 0) { + manager.createNewConnection(message); } else if (!message.isRead()) { mXmppConnectionService.getNotificationService().push(message); } |