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

Commit ecf4129f authored by Alexandre Roux's avatar Alexandre Roux Committed by Sumit Pundir
Browse files

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

parent 9478912a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
package foundation.e.mail.mail.autoconfiguration;


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

/**
 * An interface for autoconfiguration
 */
@@ -31,6 +35,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
@@ -23,7 +23,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;