Added debug option to disable idle/done

pull/206/head
M66B 3 years ago
parent 17ac5b7b22
commit cfd6eadf90

@ -60,6 +60,7 @@ public class IMAPProtocol extends Protocol {
private boolean connected = false; // did constructor succeed?
private boolean rev1 = false; // REV1 server ?
private boolean referralException; // throw exception for IMAP REFERRAL?
private boolean idledone;
private boolean noauthdebug = true; // hide auth info in debug output
private boolean authenticated; // authenticated?
// WARNING: authenticated may be set to true in superclass
@ -108,6 +109,8 @@ public class IMAPProtocol extends Protocol {
try {
this.name = name;
idledone = PropUtil.getBooleanProperty(props, "mail.idledone", true);
eu.faircode.email.Log.i("idledone=" + idledone);
noauthdebug =
!PropUtil.getBooleanProperty(props, "mail.debug.auth", false);
@ -3217,7 +3220,7 @@ public class IMAPProtocol extends Protocol {
boolean done = false; // done reading responses?
notifyResponseHandlers(responses);
if (r.isUnTagged() && r.isOK()) // Still here
if (idledone && r.isUnTagged() && r.isOK()) // Still here
idleAbort();
if (r.isBYE()) // shouldn't wait for command completion response

@ -213,6 +213,9 @@ public class EmailService implements AutoCloseable {
properties.put("mail." + protocol + ".timeout", Integer.toString(timeout * factor));
}
boolean idle_done = prefs.getBoolean("idle_done", true);
properties.put("mail.idledone", Boolean.toString(idle_done));
if (debug && BuildConfig.DEBUG)
properties.put("mail.debug.auth", "true");

@ -144,6 +144,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swAuthLogin;
private SwitchCompat swAuthNtlm;
private SwitchCompat swAuthSasl;
private SwitchCompat swIdleDone;
private SwitchCompat swExactAlarms;
private SwitchCompat swDupMsgId;
private SwitchCompat swTestIab;
@ -177,7 +178,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"protocol", "debug", "log_level",
"query_threads", "wal", "checkpoints", "sqlite_cache",
"chunk_size", "use_modseq", "perform_expunge",
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl",
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "idle_done",
"exact_alarms", "dup_msgids", "test_iab"
};
@ -273,6 +274,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swAuthLogin = view.findViewById(R.id.swAuthLogin);
swAuthNtlm = view.findViewById(R.id.swAuthNtlm);
swAuthSasl = view.findViewById(R.id.swAuthSasl);
swIdleDone = view.findViewById(R.id.swIdleDone);
swExactAlarms = view.findViewById(R.id.swExactAlarms);
swDupMsgId = view.findViewById(R.id.swDupMsgId);
swTestIab = view.findViewById(R.id.swTestIab);
@ -853,6 +855,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swIdleDone.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("idle_done", checked).apply();
}
});
swExactAlarms.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1322,6 +1331,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swAuthLogin.setChecked(prefs.getBoolean("auth_login", true));
swAuthNtlm.setChecked(prefs.getBoolean("auth_ntlm", true));
swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true));
swIdleDone.setChecked(prefs.getBoolean("idle_done", true));
swExactAlarms.setChecked(prefs.getBoolean("exact_alarms", true));
swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false));
swTestIab.setChecked(prefs.getBoolean("test_iab", false));

@ -150,7 +150,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
"download_headers", "download_eml",
"prefer_ip4", "bind_socket", "standalone_vpn", "tcp_keep_alive", "ssl_harden", // force reconnect
"experiments", "debug", "protocol", // force reconnect
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", // force reconnect
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "idle_done", // force reconnect
"exact_alarms" // force schedule
));

@ -839,6 +839,18 @@
app:layout_constraintTop_toBottomOf="@id/swAuthNtlm"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swIdleDone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_idle_done"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAuthSasl"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swExactAlarms"
android:layout_width="0dp"
@ -847,7 +859,7 @@
android:text="@string/title_advanced_exact_alarms"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAuthSasl"
app:layout_constraintTop_toBottomOf="@id/swIdleDone"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -665,6 +665,7 @@
<string name="title_advanced_auth_login" translatable="false">LOGIN</string>
<string name="title_advanced_auth_ntlm" translatable="false">NTLM</string>
<string name="title_advanced_auth_sasl" translatable="false">SASL</string>
<string name="title_advanced_idle_done" translatable="false">IDLE/DONE</string>
<string name="title_advanced_exact_alarms" translatable="false">Use exact timers</string>
<string name="title_advanced_dup_msgid" translatable="false">Duplicates by message ID</string>
<string name="title_advanced_test_iab" translatable="false">Test IAB</string>

Loading…
Cancel
Save