Removed prefer IPv4 settings, refactoring

This commit is contained in:
M66B
2019-07-27 16:40:51 +02:00
parent 4a72f7ff90
commit f661a7c09b
11 changed files with 29 additions and 62 deletions

View File

@@ -72,7 +72,6 @@ import java.util.Properties;
import javax.mail.Folder;
import javax.mail.Session;
import javax.mail.Store;
import static android.app.Activity.RESULT_OK;
import static com.google.android.material.textfield.TextInputLayout.END_ICON_NONE;
@@ -536,10 +535,10 @@ public class FragmentAccount extends FragmentBase {
Properties props = MessageHelper.getSessionProperties(realm, insecure);
Session isession = Session.getInstance(props, null);
isession.setDebug(true);
try (Store istore = isession.getStore("imap" + (starttls ? "" : "s"))) {
istore.connect(host, Integer.parseInt(port), user, password);
try (IMAPStore istore = (IMAPStore) isession.getStore("imap" + (starttls ? "" : "s"))) {
ConnectionHelper.connect(context, isession, istore, host, Integer.parseInt(port), user, password);
result.idle = ((IMAPStore) istore).hasCapability("IDLE");
result.idle = istore.hasCapability("IDLE");
boolean inbox = false;
boolean archive = false;
@@ -893,8 +892,8 @@ public class FragmentAccount extends FragmentBase {
Session isession = Session.getInstance(props, null);
isession.setDebug(true);
try (Store istore = isession.getStore("imap" + (starttls ? "" : "s"))) {
istore.connect(host, Integer.parseInt(port), user, password);
try (IMAPStore istore = (IMAPStore) isession.getStore("imap" + (starttls ? "" : "s"))) {
ConnectionHelper.connect(context, isession, istore, host, Integer.parseInt(port), user, password);
for (Folder ifolder : istore.getDefaultFolder().list("*")) {
// Check folder attributes