aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-04-01 00:03:14 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-04-01 00:03:14 +0200
commit2549ce89b0fac2a41c4de61c42d76e521875717f (patch)
tree82c1276915d3be029e05015714e750fc48ca15ab /src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
parent74c496fe3ef544d45c94365799c061ddfe898330 (diff)
check max http file size when attaching files
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
index ae722081..90333cfe 100644
--- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
@@ -24,6 +24,7 @@ import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
+import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.adapter.ConversationAdapter;
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
@@ -259,6 +260,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
}
private void share(final Conversation conversation) {
+ final Account account = conversation.getAccount();
mListView.setEnabled(false);
if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP && !hasPgp()) {
if (share.uuid == null) {
@@ -270,6 +272,9 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
return;
}
if (share.uris.size() != 0) {
+ final long max = account.getXmppConnection()
+ .getFeatures()
+ .getMaxHttpUploadSize();
OnPresenceSelected callback = new OnPresenceSelected() {
@Override
public void onPresenceSelected() {
@@ -290,7 +295,11 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
}
}
};
- if (conversation.getAccount().httpUploadAvailable()) {
+ if (account.httpUploadAvailable()
+ && (
+ (share.image && !neverCompressPictures())
+ || conversation.getMode() == Conversation.MODE_MULTI
+ || FileBackend.allFilesUnderSize(this, share.uris, max))) {
callback.onPresenceSelected();
} else {
selectPresence(conversation, callback);