aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-04-02 18:07:38 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-04-02 18:07:38 +0200
commit701742f5500ade311741c8af59fcd73181a6e6f6 (patch)
tree062b4452e9f949120c9de35426529c5977838eba
parent2549ce89b0fac2a41c4de61c42d76e521875717f (diff)
don't ask for resource when server uses http upload v0.1
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java5
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java3
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java6
3 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index 6e118ec2..21ba4509 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -114,7 +114,7 @@ public class FileBackend {
}
}
- public static long getFileSize(Context context, Uri uri) {
+ private static long getFileSize(Context context, Uri uri) {
Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
return cursor.getLong(cursor.getColumnIndex(OpenableColumns.SIZE));
@@ -124,6 +124,9 @@ public class FileBackend {
}
public static boolean allFilesUnderSize(Context context, List<Uri> uris, long max) {
+ if (max <= 0) {
+ return true; //exception to be compatible with HTTP Upload < v0.2
+ }
for(Uri uri : uris) {
if (FileBackend.getFileSize(context, uri) > max) {
return false;
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 42252ede..184b5dc6 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -1317,8 +1317,7 @@ public class ConversationActivity extends XmppActivity
}
}
};
- if (max <= 0
- || c.getMode() == Conversation.MODE_MULTI
+ if (c.getMode() == Conversation.MODE_MULTI
|| FileBackend.allFilesUnderSize(this, uris, max)
|| c.getNextEncryption() == Message.ENCRYPTION_OTR) {
callback.onPresenceSelected();
diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
index 90333cfe..8cd017bf 100644
--- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
@@ -296,10 +296,10 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
}
};
if (account.httpUploadAvailable()
- && (
- (share.image && !neverCompressPictures())
+ && ((share.image && !neverCompressPictures())
|| conversation.getMode() == Conversation.MODE_MULTI
- || FileBackend.allFilesUnderSize(this, share.uris, max))) {
+ || FileBackend.allFilesUnderSize(this, share.uris, max))
+ && conversation.getNextEncryption() != Message.ENCRYPTION_OTR) {
callback.onPresenceSelected();
} else {
selectPresence(conversation, callback);