diff --git a/app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java b/app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
index 23d0b9efa0..b876924e60 100644
--- a/app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
+++ b/app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
@@ -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
diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java
index b62ba933a9..f676992422 100644
--- a/app/src/main/java/eu/faircode/email/EmailService.java
+++ b/app/src/main/java/eu/faircode/email/EmailService.java
@@ -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");
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
index e8b8b157d5..8a36900188 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
@@ -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));
diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java
index 2e4125adc0..bec5480a62 100644
--- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java
+++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java
@@ -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
));
diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml
index 05868d8589..1749554c62 100644
--- a/app/src/main/res/layout/fragment_options_misc.xml
+++ b/app/src/main/res/layout/fragment_options_misc.xml
@@ -839,6 +839,18 @@
app:layout_constraintTop_toBottomOf="@id/swAuthNtlm"
app:switchPadding="12dp" />
+
+
LOGIN
NTLM
SASL
+ IDLE/DONE
Use exact timers
Duplicates by message ID
Test IAB