From 353b3cb621837dcd2af63cffb2e53195b46e3398 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 25 Oct 2025 07:28:32 +0200 Subject: [PATCH] Added debug option to disable IMAP compress --- .../main/java/eu/faircode/email/EmailService.java | 3 ++- .../eu/faircode/email/FragmentOptionsMisc.java | 12 +++++++++++- .../java/eu/faircode/email/ServiceSynchronize.java | 2 +- app/src/main/res/layout/fragment_options_misc.xml | 14 +++++++++++++- app/src/main/res/values/strings.xml | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 2af3c6ef56..d53247dd51 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -219,6 +219,7 @@ public class EmailService implements AutoCloseable { this.cert_transparency = prefs.getBoolean("cert_transparency", false); this.check_names = prefs.getBoolean("check_names", !BuildConfig.PLAY_STORE_RELEASE); + boolean imap_compress = prefs.getBoolean("imap_compress", true); boolean auth_plain = prefs.getBoolean("auth_plain", true); boolean auth_login = prefs.getBoolean("auth_login", true); boolean auth_ntlm = prefs.getBoolean("auth_ntlm", true); @@ -311,7 +312,7 @@ public class EmailService implements AutoCloseable { // https://tools.ietf.org/html/rfc4978 // https://docs.oracle.com/javase/8/docs/api/java/util/zip/Deflater.html - properties.put("mail." + protocol + ".compress.enable", "true"); + properties.put("mail." + protocol + ".compress.enable", Boolean.toString(imap_compress)); //properties.put("mail.imaps.compress.level", "-1"); //properties.put("mail.imaps.compress.strategy", "0"); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 5be5801f58..1dd6580e70 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -207,6 +207,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swUid; private SwitchCompat swExpunge; private SwitchCompat swUidExpunge; + private SwitchCompat swImapCompress; private SwitchCompat swAuthPlain; private SwitchCompat swAuthLogin; private SwitchCompat swAuthNtlm; @@ -307,7 +308,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "ignore_formatted_size", "show_recent", "use_modseq", "preamble", "uid_command", "perform_expunge", "uid_expunge", - "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "use_top", "forget_top", + "imap_compress", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "use_top", "forget_top", "keep_alive_poll", "empty_pool", "idle_done", "fast_fetch", "max_backoff_power", "logarithmic_backoff", "exact_alarms", @@ -479,6 +480,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swUid = view.findViewById(R.id.swUid); swExpunge = view.findViewById(R.id.swExpunge); swUidExpunge = view.findViewById(R.id.swUidExpunge); + swImapCompress = view.findViewById(R.id.swImapCompress); swAuthPlain = view.findViewById(R.id.swAuthPlain); swAuthLogin = view.findViewById(R.id.swAuthLogin); swAuthNtlm = view.findViewById(R.id.swAuthNtlm); @@ -1532,6 +1534,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swImapCompress.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("imap_compress", checked).apply(); + } + }); + swAuthPlain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -2613,6 +2622,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swUid.setChecked(prefs.getBoolean("uid_command", false)); swExpunge.setChecked(prefs.getBoolean("perform_expunge", true)); swUidExpunge.setChecked(prefs.getBoolean("uid_expunge", false)); + swImapCompress.setChecked(prefs.getBoolean("imap_compress", true)); swAuthPlain.setChecked(prefs.getBoolean("auth_plain", true)); swAuthLogin.setChecked(prefs.getBoolean("auth_login", true)); swAuthNtlm.setChecked(prefs.getBoolean("auth_ntlm", true)); diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 4461d91aff..98c23e56ed 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -182,7 +182,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences "ssl_harden", "ssl_harden_strict", "cert_strict", "cert_transparency", "check_names", "bouncy_castle", "bc_fips", // force reconnect "experiments", "debug", "protocol", // force reconnect //"restart_interval", // force reconnect - "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", // force reconnect + "imap_compress", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", // force reconnect "keep_alive_poll", "empty_pool", "idle_done", // force reconnect "exact_alarms" // force schedule )); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 34d52b89b1..17e58f8b0a 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -1480,6 +1480,18 @@ app:layout_constraintTop_toBottomOf="@id/swExpunge" app:switchPadding="12dp" /> + + AUTO EXPUNGE UID EXPUNGE Hide deleted messages + COMPRESS PLAIN LOGIN NTLM