From 0157039e87f5843189641aab2e6f827dcd4d0051 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 5 May 2016 19:34:44 +0200 Subject: =?UTF-8?q?log=20more=20information=20about=20HTTP=E2=80=99s=20max?= =?UTF-8?q?=20upload=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 2 ++ src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index df510efe..db48c8b3 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -134,10 +134,12 @@ public class FileBackend { public static boolean allFilesUnderSize(Context context, List uris, long max) { if (max <= 0) { + Log.d(Config.LOGTAG,"server did not report max file size for http upload"); return true; //exception to be compatible with HTTP Upload < v0.2 } for(Uri uri : uris) { if (FileBackend.getFileSize(context, uri) > max) { + Log.d(Config.LOGTAG,"not all files are under "+max+" bytes. suggesting falling back to jingle"); return false; } } diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 687f07da..26139f8e 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1555,7 +1555,12 @@ public class XmppConnection implements Runnable { if (items.size() > 0) { try { long maxsize = Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Xmlns.HTTP_UPLOAD, "max-file-size")); - return filesize <= maxsize; + if(filesize <= maxsize) { + return true; + } else { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": http upload is not available for files with size "+filesize+" (max is "+maxsize+")"); + return false; + } } catch (Exception e) { return true; } -- cgit v1.2.3