Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 691abb9f authored by Alexandre Roux's avatar Alexandre Roux
Browse files

when multiple protocols available, avoid the ones we don't handle

parent ca4760fe
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@
package foundation.e.mail.mail.autoconfiguration;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * An interface for autoconfiguration
 */
@@ -35,6 +39,10 @@ public interface AutoConfigure {
        public static String INCOMING_TYPE_POP3 = "pop3";
        public static String OUTGOING_TYPE_SMTP = "smtp";

        public static List<String> INCOMING_TYPES = new ArrayList<>(
                Arrays.asList(INCOMING_TYPE_IMAP, INCOMING_TYPE_POP3)
        );

        public static String SOCKET_TYPE_SSL_OR_TLS = "ssl";
        public static String SOCKET_TYPE_STARTTLS = "tls";

+7 −1
Original line number Diff line number Diff line
@@ -27,7 +27,13 @@ public class AutoconfigureMozilla implements AutoConfigure {
    public ProviderInfo parse(Document document) {
        ProviderInfo providerInfo = new ProviderInfo();

        Element incomingElement = document.select("incomingServer").first();
        Element incomingElement = null;
        for(Element element: document.select("incomingServer")){
            if(ProviderInfo.INCOMING_TYPES.contains(element.attr("type"))){
                incomingElement = element;
                break;
            }
        }
        if (incomingElement == null) return null;
        Element incomingHostnameElement = incomingElement.select("hostname").first();
        if (incomingHostnameElement == null) return null;