Refactoring

This commit is contained in:
M66B 2019-04-12 08:28:23 +02:00
parent fe933314e8
commit 7e6655faea
1 changed files with 6 additions and 6 deletions

View File

@ -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) {