From b8b0613be4d0ef40c91c1b82b3d1116cd289b64e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 6 Mar 2012 14:09:16 +0100 Subject: Bug #671233 - Unable to choose port 587 for SMTP --- widgets/misc/e-port-entry.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'widgets/misc/e-port-entry.c') diff --git a/widgets/misc/e-port-entry.c b/widgets/misc/e-port-entry.c index cc90302771..84a514b653 100644 --- a/widgets/misc/e-port-entry.c +++ b/widgets/misc/e-port-entry.c @@ -114,9 +114,9 @@ port_entry_method_changed (EPortEntry *port_entry) { CamelNetworkSecurityMethod method; gboolean standard_port = FALSE; - gboolean valid; + gboolean valid, have_ssl = FALSE, have_nossl = FALSE; gint port = 0; - gint ii = 0; + gint ii; method = e_port_entry_get_security_method (port_entry); valid = port_entry_get_numeric_port (port_entry, &port); @@ -126,12 +126,23 @@ port_entry_method_changed (EPortEntry *port_entry) * leave custom port numbers alone. */ if (valid && port_entry->priv->entries != NULL) { - while (port_entry->priv->entries[ii].port > 0) { + for (ii = 0; port_entry->priv->entries[ii].port > 0 && (!have_ssl || !have_nossl); ii++) { + /* Use only the first SSL/no-SSL port as a default in the list + and skip the others */ + if (port_entry->priv->entries[ii].is_ssl) { + if (have_ssl) + continue; + have_ssl = TRUE; + } else { + if (have_nossl) + continue; + have_nossl = TRUE; + } + if (port == port_entry->priv->entries[ii].port) { standard_port = TRUE; break; } - ii++; } } -- cgit v1.2.3