From 1ed355c9e4807a8342e1093db364ee0c1b09ad44 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 24 Aug 2023 09:35:56 +0200 Subject: [PATCH] Forget TOP headers --- .../main/java/eu/faircode/email/EmailService.java | 6 +++++- .../eu/faircode/email/FragmentOptionsMisc.java | 12 +++++++++++- app/src/main/res/layout/fragment_options_misc.xml | 14 +++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 17d350f444..3154e2a65b 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -195,13 +195,15 @@ public class EmailService implements AutoCloseable { boolean auth_sasl = prefs.getBoolean("auth_sasl", true); boolean auth_apop = prefs.getBoolean("auth_apop", false); boolean use_top = prefs.getBoolean("use_top", true); + boolean forget_top = prefs.getBoolean("forget_top", true); Log.i("Authenticate" + " plain=" + auth_plain + " login=" + auth_login + " ntlm=" + auth_ntlm + " sasl=" + auth_sasl + " apop=" + auth_apop + - " use_top=" + use_top); + " use_top=" + use_top + + " forget_top=" + forget_top); //properties.put("mail.event.scope", "folder"); //properties.put("mail.event.executor", executor); @@ -216,6 +218,8 @@ public class EmailService implements AutoCloseable { properties.put("mail." + protocol + ".apop.enable", "true"); if (!use_top) properties.put("mail." + protocol + ".disabletop", "true"); + if (forget_top) + properties.put("mail." + protocol + ".forgettopheaders", "true"); // SASL is attempted before other authentication methods properties.put("mail." + protocol + ".sasl.enable", Boolean.toString(auth_sasl)); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 2e8721b07e..c101500a97 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -224,6 +224,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swAuthSasl; private SwitchCompat swAuthApop; private SwitchCompat swUseTop; + private SwitchCompat swForgetTop; private SwitchCompat swKeepAlivePoll; private SwitchCompat swEmptyPool; private SwitchCompat swIdleDone; @@ -299,7 +300,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "browser_zoom", "fake_dark", "show_recent", "use_modseq", "preamble", "uid_command", "perform_expunge", "uid_expunge", - "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "use_top", + "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", @@ -477,6 +478,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swAuthSasl = view.findViewById(R.id.swAuthSasl); swAuthApop = view.findViewById(R.id.swAuthApop); swUseTop = view.findViewById(R.id.swUseTop); + swForgetTop = view.findViewById(R.id.swForgetTop); swKeepAlivePoll = view.findViewById(R.id.swKeepAlivePoll); swEmptyPool = view.findViewById(R.id.swEmptyPool); swIdleDone = view.findViewById(R.id.swIdleDone); @@ -1738,6 +1740,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swForgetTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("forget_top", checked).apply(); + } + }); + swKeepAlivePoll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -2607,6 +2616,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true)); swAuthApop.setChecked(prefs.getBoolean("auth_apop", false)); swUseTop.setChecked(prefs.getBoolean("use_top", true)); + swForgetTop.setChecked(prefs.getBoolean("forget_top", true)); swKeepAlivePoll.setChecked(prefs.getBoolean("keep_alive_poll", false)); swEmptyPool.setChecked(prefs.getBoolean("empty_pool", true)); swIdleDone.setChecked(prefs.getBoolean("idle_done", true)); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 8f8d6171ed..f115a5bbbd 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -1850,6 +1850,18 @@ app:layout_constraintTop_toBottomOf="@id/swAuthApop" app:switchPadding="12dp" /> + + SASL APOP Use TOP + Forget TOP headers IDLE/DONE Fast FETCH Max. back-off: %1$d s