diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index ea3002013f..451dc7480a 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -190,12 +190,14 @@ public class EmailService implements AutoCloseable { boolean auth_ntlm = prefs.getBoolean("auth_ntlm", true); boolean auth_sasl = prefs.getBoolean("auth_sasl", true); boolean auth_apop = prefs.getBoolean("auth_apop", false); + boolean disable_top = prefs.getBoolean("disable_top", false); Log.i("Authenticate" + " plain=" + auth_plain + " login=" + auth_login + " ntlm=" + auth_ntlm + " sasl=" + auth_sasl + - " apop=" + auth_apop); + " apop=" + auth_apop + + " disable_top=" + disable_top); properties.put("mail.event.scope", "folder"); properties.put("mail.event.executor", executor); @@ -208,6 +210,8 @@ public class EmailService implements AutoCloseable { properties.put("mail." + protocol + ".auth.ntlm.disable", "true"); if (auth_apop) properties.put("mail." + protocol + ".apop.enable", "true"); + if (disable_top) + properties.put("mail." + protocol + ".disabletop", "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 a67363da78..6d8eeba482 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -173,6 +173,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swAuthNtlm; private SwitchCompat swAuthSasl; private SwitchCompat swAuthApop; + private SwitchCompat swDisableTop; private SwitchCompat swKeepAlivePoll; private SwitchCompat swEmptyPool; private SwitchCompat swIdleDone; @@ -222,7 +223,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "webview_legacy", "browser_zoom", "fake_dark", "show_recent", "use_modseq", "uid_command", "perform_expunge", "uid_expunge", - "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", + "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "disable_top", "keep_alive_poll", "empty_pool", "idle_done", "logarithmic_backoff", "exact_alarms", "infra", "dkim_verify", "dup_msgids", "test_iab" }; @@ -354,6 +355,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swAuthNtlm = view.findViewById(R.id.swAuthNtlm); swAuthSasl = view.findViewById(R.id.swAuthSasl); swAuthApop = view.findViewById(R.id.swAuthApop); + swDisableTop = view.findViewById(R.id.swDisableTop); swKeepAlivePoll = view.findViewById(R.id.swKeepAlivePoll); swEmptyPool = view.findViewById(R.id.swEmptyPool); swIdleDone = view.findViewById(R.id.swIdleDone); @@ -1149,6 +1151,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swDisableTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("disable_top", checked).apply(); + } + }); + swKeepAlivePoll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -1808,6 +1817,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swAuthNtlm.setChecked(prefs.getBoolean("auth_ntlm", true)); swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true)); swAuthApop.setChecked(prefs.getBoolean("auth_apop", false)); + swDisableTop.setChecked(prefs.getBoolean("disable_top", false)); 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 d743244ded..760c8a6720 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -1183,6 +1183,17 @@ app:layout_constraintTop_toBottomOf="@id/swAuthSasl" app:switchPadding="12dp" /> + + NTLM SASL APOP + Disable TOP IDLE/DONE Logarithmic back-off Turning this off can result in a significant increase in battery usage!