Refactoring

This commit is contained in:
M66B
2020-02-06 13:06:10 +01:00
parent e1a785afc3
commit c912f99bce
8 changed files with 60 additions and 21 deletions

View File

@@ -615,8 +615,12 @@ public class FragmentAccount extends FragmentBase {
// Check IMAP server / get folders
String protocol = "imap" + (starttls ? "" : "s");
try (EmailService iservice = new EmailService(context, protocol, realm, insecure, EmailService.PURPOSE_CHECK, true)) {
iservice.connect(host, Integer.parseInt(port), auth, provider, user, password, fingerprint);
try (EmailService iservice = new EmailService(
context, protocol, realm, insecure, EmailService.PURPOSE_CHECK, true)) {
iservice.connect(
host, Integer.parseInt(port),
auth, provider,
user, password, fingerprint);
result.idle = iservice.hasCapability("IDLE");
@@ -983,8 +987,12 @@ public class FragmentAccount extends FragmentBase {
EntityFolder inbox = null;
if (check) {
String protocol = "imap" + (starttls ? "" : "s");
try (EmailService iservice = new EmailService(context, protocol, realm, insecure, EmailService.PURPOSE_CHECK, true)) {
iservice.connect(host, Integer.parseInt(port), auth, provider, user, password, fingerprint);
try (EmailService iservice = new EmailService(
context, protocol, realm, insecure, EmailService.PURPOSE_CHECK, true)) {
iservice.connect(
host, Integer.parseInt(port),
auth, provider,
user, password, fingerprint);
for (Folder ifolder : iservice.getStore().getDefaultFolder().list("*")) {
// Check folder attributes