Empty heads

pull/163/head
M66B 5 years ago
parent c206fa52b5
commit 1624f6e024

@ -556,6 +556,7 @@ public class FragmentAccount extends FragmentBase {
iservice.connect(host, Integer.parseInt(port), auth, user, password);
result.idle = iservice.hasCapability("IDLE");
result.empty = iservice.emptyMessages();
boolean inbox = false;
@ -625,6 +626,8 @@ public class FragmentAccount extends FragmentBase {
protected void onExecuted(Bundle args, CheckResult result) {
tvIdle.setVisibility(result.idle ? View.GONE : View.VISIBLE);
tvUtf8.setVisibility(result.utf8 == null || result.utf8 ? View.GONE : View.VISIBLE);
if (result.empty)
cbPartialFetch.setChecked(false);
setFolders(result.folders, result.account);
@ -1483,5 +1486,6 @@ public class FragmentAccount extends FragmentBase {
List<EntityFolder> folders;
boolean idle;
Boolean utf8;
boolean empty;
}
}

@ -241,6 +241,7 @@ public class FragmentQuickSetup extends FragmentBase {
String user = (provider.user == EmailProvider.UserType.EMAIL ? email : dparts[0]);
Log.i("User type=" + provider.user + " name=" + user);
boolean empty;
List<EntityFolder> folders;
String aprotocol = provider.imap.starttls ? "imap" : "imaps";
@ -257,6 +258,7 @@ public class FragmentQuickSetup extends FragmentBase {
throw ex;
}
empty = iservice.emptyMessages();
folders = iservice.getFolders();
if (folders == null)
@ -293,6 +295,9 @@ public class FragmentQuickSetup extends FragmentBase {
account.synchronize = true;
account.primary = (primary == null);
if (empty)
account.partial_fetch = false;
account.created = new Date().getTime();
account.last_connected = account.created;

@ -18,6 +18,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
@ -38,6 +39,7 @@ public class MailService implements AutoCloseable {
private Properties properties;
private Session isession;
private Service iservice;
private boolean empty;
private ExecutorService executor = Helper.getBackgroundExecutor(0, "mail");
@ -264,6 +266,19 @@ public class MailService implements AutoCloseable {
for (String key : sid.keySet()) {
crumb.put(key, sid.get(key));
EntityLog.log(context, "Server " + key + "=" + sid.get(key));
if ("name".equals(key)) {
String name = sid.get(key);
if (!TextUtils.isEmpty(name)) {
name = name.toLowerCase(Locale.ROOT);
// name=Amazon WorkMail IMAP version=1.0
// name=Microsoft.Exchange.Imap4.Imap4Server version=15
if ((name.contains("amazon") && name.contains("workmail")) ||
(name.contains("microsoft") && name.contains("exchange")))
empty = true;
}
}
}
Log.breadcrumb("server", crumb);
}
@ -368,6 +383,10 @@ public class MailService implements AutoCloseable {
return false;
}
boolean emptyMessages() {
return this.empty;
}
public void close() throws MessagingException {
try {
if (iservice != null && iservice.isConnected())

Loading…
Cancel
Save