From 2a198793b1fac99b30553262ae89b41f0900d07e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 18 Jul 2017 12:43:53 +0200 Subject: [PATCH] fixed otr jingle file size reporting --- src/main/java/eu/siacs/conversations/Config.java | 2 -- .../conversations/services/AbstractConnectionManager.java | 3 +-- .../siacs/conversations/xmpp/jingle/JingleConnection.java | 6 +----- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index d358d0619..d79683d41 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -96,8 +96,6 @@ public final class Config { public static final boolean ENCRYPT_ON_HTTP_UPLOADED = false; - public static final boolean REPORT_WRONG_FILESIZE_IN_OTR_JINGLE = true; - public static final boolean X509_VERIFICATION = false; //use x509 certificates to verify OMEMO keys public static final boolean ONLY_INTERNAL_STORAGE = false; //use internal storage instead of sdcard to save attachments diff --git a/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java b/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java index 04fb753c2..f036f32d4 100644 --- a/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java @@ -81,8 +81,7 @@ public class AbstractConnectionManager { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(file.getKey(), "AES"), ips); Log.d(Config.LOGTAG, "opening encrypted input stream"); - final int s = Config.REPORT_WRONG_FILESIZE_IN_OTR_JINGLE ? size : (size / 16 + 1) * 16; - return new Pair(new CipherInputStream(is, cipher),s); + return new Pair(new CipherInputStream(is, cipher),(size / 16 + 1) * 16); } } catch (InvalidKeyException e) { return null; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index e9fd2244f..6f701aff5 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -459,11 +459,7 @@ public class JingleConnection implements Transferable { } } this.mFileOutputStream = AbstractConnectionManager.createOutputStream(this.file,message.getEncryption() == Message.ENCRYPTION_AXOLOTL); - if (message.getEncryption() == Message.ENCRYPTION_OTR && Config.REPORT_WRONG_FILESIZE_IN_OTR_JINGLE) { - this.file.setExpectedSize((size / 16 + 1) * 16); - } else { - this.file.setExpectedSize(size); - } + this.file.setExpectedSize(size); Log.d(Config.LOGTAG, "receiving file: expecting size of " + this.file.getExpectedSize()); } else { this.sendCancel();