Forget TOP headers

This commit is contained in:
M66B 2023-08-24 09:35:56 +02:00
parent f1b8431bba
commit 1ed355c9e4
4 changed files with 30 additions and 3 deletions

View File

@ -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));

View File

@ -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));

View File

@ -1850,6 +1850,18 @@
app:layout_constraintTop_toBottomOf="@id/swAuthApop"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swForgetTop"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_forget_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swUseTop"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swKeepAlivePoll"
android:layout_width="0dp"
@ -1858,7 +1870,7 @@
android:text="@string/title_advanced_keep_alive_poll"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swUseTop"
app:layout_constraintTop_toBottomOf="@id/swForgetTop"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -887,6 +887,7 @@
<string name="title_advanced_auth_sasl" translatable="false">SASL</string>
<string name="title_advanced_auth_apop" translatable="false">APOP</string>
<string name="title_advanced_use_top" translatable="false">Use TOP</string>
<string name="title_advanced_forget_top" translatable="false">Forget TOP headers</string>
<string name="title_advanced_idle_done" translatable="false">IDLE/DONE</string>
<string name="title_advanced_fast_fetch" translatable="false">Fast FETCH</string>
<string name="title_advanced_max_backoff" translatable="false">Max. back-off: %1$d s</string>