do not check image file size over http if accepted file size is 0

This commit is contained in:
Daniel Gultsch 2015-01-11 22:18:18 +01:00
parent b07b7519a6
commit ef6e4c5dd5
2 changed files with 11 additions and 6 deletions

View File

@ -19,6 +19,7 @@ import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.DownloadableFile; import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.http.HttpConnectionManager;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.UiCallback; import eu.siacs.conversations.ui.UiCallback;
import android.app.PendingIntent; import android.app.PendingIntent;
@ -56,9 +57,11 @@ public class PgpEngine {
if (message.getEncryption() == Message.ENCRYPTION_PGP) { if (message.getEncryption() == Message.ENCRYPTION_PGP) {
message.setBody(os.toString()); message.setBody(os.toString());
message.setEncryption(Message.ENCRYPTION_DECRYPTED); message.setEncryption(Message.ENCRYPTION_DECRYPTED);
if (message.trusted() && message.bodyContainsDownloadable()) { final HttpConnectionManager manager = mXmppConnectionService.getHttpConnectionManager();
mXmppConnectionService.getHttpConnectionManager() if (message.trusted()
.createNewConnection(message); && message.bodyContainsDownloadable()
&& manager.getAutoAcceptFileSize() > 0) {
manager.createNewConnection(message);
} }
callback.success(message); callback.success(message);
} }

View File

@ -8,6 +8,8 @@ import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.MucOptions; 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.MessageArchiveService;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
@ -575,9 +577,9 @@ public class MessageParser extends AbstractParser implements
mXmppConnectionService.databaseBackend.createMessage(message); mXmppConnectionService.databaseBackend.createMessage(message);
} }
} }
if (message.trusted() && message.bodyContainsDownloadable()) { final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager();
this.mXmppConnectionService.getHttpConnectionManager() if (message.trusted() && message.bodyContainsDownloadable() && manager.getAutoAcceptFileSize() > 0) {
.createNewConnection(message); manager.createNewConnection(message);
} else if (!message.isRead()) { } else if (!message.isRead()) {
mXmppConnectionService.getNotificationService().push(message); mXmppConnectionService.getNotificationService().push(message);
} }