Added quick config from template

This commit is contained in:
M66B 2019-04-12 08:38:15 +02:00
parent 7e6655faea
commit 02012981a6
1 changed files with 17 additions and 1 deletions

View File

@ -129,14 +129,17 @@ public class EmailProvider {
static EmailProvider fromDomain(Context context, String domain) throws IOException { static EmailProvider fromDomain(Context context, String domain) throws IOException {
try { try {
Log.i("Provider from ISPDB domain=" + domain);
return addSpecials(context, fromISPDB(domain)); return addSpecials(context, fromISPDB(domain));
} catch (Throwable ex) { } catch (Throwable ex) {
Log.w(ex); Log.w(ex);
try { try {
Log.i("Provider from DNS domain=" + domain);
return addSpecials(context, fromDNS(domain)); return addSpecials(context, fromDNS(domain));
} catch (UnknownHostException ex1) { } catch (UnknownHostException ex1) {
Log.w(ex1); Log.w(ex1);
throw new UnknownHostException(context.getString(R.string.title_setup_no_settings, domain)); Log.i("Provider from template domain=" + domain);
return addSpecials(context, fromTemplate(domain));
} }
} }
} }
@ -336,6 +339,19 @@ public class EmailProvider {
return provider; return provider;
} }
private static EmailProvider fromTemplate(String domain) {
EmailProvider provider = new EmailProvider(domain);
provider.imap_host = "imap." + domain;
provider.imap_port = 993;
provider.imap_starttls = false;
provider.smtp_host = "smtp." + domain;
provider.smtp_port = 587;
provider.smtp_starttls = true;
return provider;
}
private static void addDocumentation(EmailProvider provider, String href, String title) { private static void addDocumentation(EmailProvider provider, String href, String title) {
if (provider.documentation == null) if (provider.documentation == null)
provider.documentation = new StringBuilder(); provider.documentation = new StringBuilder();