Reorder send_message's port selection logic, paving the
authorColin Leroy <colin@colino.net>
Thu, 30 May 2013 09:35:16 +0000 (11:35 +0200)
committerColin Leroy <colin@colino.net>
Thu, 30 May 2013 09:37:08 +0000 (11:37 +0200)
way for bug #2252 "API for external password storage"
Patch by Michal Gorny

src/send_message.c

index e76794d70f41b015db1ecaf91c1a18a5c18149bb..4e5f6e63c02eadaa1ae649a676ac4bfd251362c6 100644 (file)
@@ -255,6 +255,34 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                        smtp_session->hostname = NULL;
                }
 
+#ifdef USE_GNUTLS
+               port = ac_prefs->set_smtpport ? ac_prefs->smtpport :
+                       ac_prefs->ssl_smtp == SSL_TUNNEL ? SSMTP_PORT : SMTP_PORT;
+               session->ssl_type = ac_prefs->ssl_smtp;
+               if (ac_prefs->ssl_smtp != SSL_NONE)
+                       session->nonblocking = ac_prefs->use_nonblocking_ssl;
+               if (ac_prefs->set_gnutls_priority && ac_prefs->gnutls_priority &&
+                   strlen(ac_prefs->gnutls_priority))
+                       session->gnutls_priority = g_strdup(ac_prefs->gnutls_priority);
+#else
+               if (ac_prefs->ssl_smtp != SSL_NONE) {
+                       if (alertpanel_full(_("Insecure connection"),
+                               _("This connection is configured to be secured "
+                                 "using SSL, but SSL is not available in this "
+                                 "build of Claws Mail. \n\n"
+                                 "Do you want to continue connecting to this "
+                                 "server? The communication would not be "
+                                 "secure."),
+                                 GTK_STOCK_CANCEL, _("Con_tinue connecting"),
+                                 NULL, FALSE, NULL, ALERT_WARNING,
+                                 G_ALERTDEFAULT) != G_ALERTALTERNATE) {
+                               session_destroy(session);
+                               return -1;
+                       }
+               }
+               port = ac_prefs->set_smtpport ? ac_prefs->smtpport : SMTP_PORT;
+#endif
+
                if (ac_prefs->use_smtp_auth) {
                        smtp_session->forced_auth_type = ac_prefs->smtp_auth_type;
                        if (ac_prefs->smtp_userid && strlen(ac_prefs->smtp_userid)) {
@@ -294,34 +322,6 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                        smtp_session->pass = NULL;
                }
 
-#ifdef USE_GNUTLS
-               port = ac_prefs->set_smtpport ? ac_prefs->smtpport :
-                       ac_prefs->ssl_smtp == SSL_TUNNEL ? SSMTP_PORT : SMTP_PORT;
-               session->ssl_type = ac_prefs->ssl_smtp;
-               if (ac_prefs->ssl_smtp != SSL_NONE)
-                       session->nonblocking = ac_prefs->use_nonblocking_ssl;
-               if (ac_prefs->set_gnutls_priority && ac_prefs->gnutls_priority &&
-                   strlen(ac_prefs->gnutls_priority))
-                       session->gnutls_priority = g_strdup(ac_prefs->gnutls_priority);
-#else
-               if (ac_prefs->ssl_smtp != SSL_NONE) {
-                       if (alertpanel_full(_("Insecure connection"),
-                               _("This connection is configured to be secured "
-                                 "using SSL, but SSL is not available in this "
-                                 "build of Claws Mail. \n\n"
-                                 "Do you want to continue connecting to this "
-                                 "server? The communication would not be "
-                                 "secure."),
-                                 GTK_STOCK_CANCEL, _("Con_tinue connecting"),
-                                 NULL, FALSE, NULL, ALERT_WARNING,
-                                 G_ALERTDEFAULT) != G_ALERTALTERNATE) {
-                               session_destroy(session);
-                               return -1;
-                       }
-               }
-               port = ac_prefs->set_smtpport ? ac_prefs->smtpport : SMTP_PORT;
-#endif
-
                send_dialog = send_progress_dialog_create();
                send_dialog->session = session;
                smtp_session->dialog = send_dialog;