[evolution] Bug #671233 - Unable to choose port 587 for SMTP



commit b8b0613be4d0ef40c91c1b82b3d1116cd289b64e
Author: Milan Crha <mcrha redhat com>
Date:   Tue Mar 6 14:09:16 2012 +0100

    Bug #671233 - Unable to choose port 587 for SMTP

 widgets/misc/e-port-entry.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/widgets/misc/e-port-entry.c b/widgets/misc/e-port-entry.c
index cc90302..84a514b 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++;
 		}
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]