From 7e6655faea5c7947861250976fd65ea4d7b738bd Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 12 Apr 2019 08:28:23 +0200 Subject: [PATCH] Refactoring --- .../main/java/eu/faircode/email/EmailProvider.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailProvider.java b/app/src/main/java/eu/faircode/email/EmailProvider.java index ec4bf5f95b..f1001a7f04 100644 --- a/app/src/main/java/eu/faircode/email/EmailProvider.java +++ b/app/src/main/java/eu/faircode/email/EmailProvider.java @@ -129,11 +129,11 @@ public class EmailProvider { static EmailProvider fromDomain(Context context, String domain) throws IOException { try { - return EmailProvider.fromISPDB(context, domain); + return addSpecials(context, fromISPDB(domain)); } catch (Throwable ex) { Log.w(ex); try { - return EmailProvider.fromDNS(context, domain); + return addSpecials(context, fromDNS(domain)); } catch (UnknownHostException ex1) { Log.w(ex1); throw new UnknownHostException(context.getString(R.string.title_setup_no_settings, domain)); @@ -141,7 +141,7 @@ public class EmailProvider { } } - private static EmailProvider fromISPDB(Context context, String domain) throws IOException, XmlPullParserException { + private static EmailProvider fromISPDB(String domain) throws IOException, XmlPullParserException { EmailProvider provider = new EmailProvider(domain); // https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat @@ -316,10 +316,10 @@ public class EmailProvider { Log.i("imap=" + provider.imap_host + ":" + provider.imap_port + ":" + provider.imap_starttls); Log.i("smtp=" + provider.smtp_host + ":" + provider.smtp_port + ":" + provider.smtp_starttls); - return addSpecials(context, provider); + return provider; } - private static EmailProvider fromDNS(Context context, String domain) throws TextParseException, UnknownHostException { + private static EmailProvider fromDNS(String domain) throws TextParseException, UnknownHostException { // https://tools.ietf.org/html/rfc6186 SRVRecord imap = lookup("_imaps._tcp." + domain); SRVRecord smtp = lookup("_submission._tcp." + domain); @@ -333,7 +333,7 @@ public class EmailProvider { provider.smtp_port = smtp.getPort(); provider.smtp_starttls = (provider.smtp_port == 587); - return addSpecials(context, provider); + return provider; } private static void addDocumentation(EmailProvider provider, String href, String title) {