From 9d3ee14fc7664363df20ad5d261d9361aa633c7e Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 12 Sep 2019 19:35:42 +0200 Subject: [PATCH] Added KPN mail --- .../java/eu/faircode/email/EmailProvider.java | 17 ++++++++++++++--- app/src/main/res/xml/providers.xml | 13 +++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailProvider.java b/app/src/main/java/eu/faircode/email/EmailProvider.java index 3a81690858..63b06f2a1e 100644 --- a/app/src/main/java/eu/faircode/email/EmailProvider.java +++ b/app/src/main/java/eu/faircode/email/EmailProvider.java @@ -43,6 +43,7 @@ import java.net.URL; import java.net.UnknownHostException; import java.text.Collator; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -55,6 +56,7 @@ import java.util.concurrent.Future; public class EmailProvider { public String name; + public List domain; public String link; public int order; public String type; @@ -103,6 +105,9 @@ public class EmailProvider { provider.name = xml.getAttributeValue(null, "name"); provider.order = xml.getAttributeIntValue(null, "order", Integer.MAX_VALUE); provider.keepalive = xml.getAttributeIntValue(null, "keepalive", 0); + String domain = xml.getAttributeValue(null, "domain"); + if (domain != null) + provider.domain = Arrays.asList(domain.split(",")); provider.link = xml.getAttributeValue(null, "link"); provider.type = xml.getAttributeValue(null, "type"); String user = xml.getAttributeValue(null, "user"); @@ -150,16 +155,22 @@ public class EmailProvider { } static EmailProvider fromDomain(Context context, String domain, Discover discover) throws IOException { - EmailProvider autoconfig = _fromDomain(context, domain, discover); + List providers = loadProfiles(context); + for (EmailProvider provider : providers) + if (provider.domain != null && provider.domain.contains(domain.toLowerCase())) { + Log.i("Provider from domain=" + domain); + return provider; + } + + EmailProvider autoconfig = _fromDomain(context, domain.toLowerCase(), discover); // Always prefer built-in profiles // - ISPDB is not always correct // - documentation links - List providers = loadProfiles(context); for (EmailProvider provider : providers) if (provider.imap.host.equals(autoconfig.imap.host) || provider.smtp.host.equals(autoconfig.smtp.host)) { - Log.i("Replacing autoconfig by profile " + provider.name); + Log.i("Replacing auto config by profile=" + provider.name); return provider; } diff --git a/app/src/main/res/xml/providers.xml b/app/src/main/res/xml/providers.xml index 2255fc353e..025c4be28d 100644 --- a/app/src/main/res/xml/providers.xml +++ b/app/src/main/res/xml/providers.xml @@ -307,4 +307,17 @@ port="465" starttls="false" /> + + + +