[evolution/gnome-3-30] I#119 - Default to TLS encryption for new Mail accounts



commit b175b67fcc7e9f37a20c9451a93ed93cc985ca16
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 10 12:17:32 2018 +0200

    I#119 - Default to TLS encryption for new Mail accounts
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/119

 src/modules/mail-config/e-mail-config-remote-accounts.c | 12 +++++++++++-
 src/modules/mail-config/e-mail-config-smtp-backend.c    | 12 +++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/modules/mail-config/e-mail-config-remote-accounts.c 
b/src/modules/mail-config/e-mail-config-remote-accounts.c
index f79d5c6068..f74ee0d5cb 100644
--- a/src/modules/mail-config/e-mail-config-remote-accounts.c
+++ b/src/modules/mail-config/e-mail-config-remote-accounts.c
@@ -172,7 +172,7 @@ mail_config_remote_backend_insert_widgets (EMailConfigServiceBackend *backend,
        EMailConfigRemoteBackend *remote_backend;
        CamelProvider *provider;
        CamelSettings *settings;
-       ESource *source;
+       ESource *source, *existing_source;
        ESourceBackend *extension;
        EMailConfigServicePage *page;
        EMailConfigServicePageClass *class;
@@ -189,6 +189,7 @@ mail_config_remote_backend_insert_widgets (EMailConfigServiceBackend *backend,
        page = e_mail_config_service_backend_get_page (backend);
        source = e_mail_config_service_backend_get_source (backend);
        settings = e_mail_config_service_backend_get_settings (backend);
+       existing_source = e_source_registry_ref_source (e_mail_config_service_page_get_registry (page), 
e_source_get_uid (source));
 
        class = E_MAIL_CONFIG_SERVICE_PAGE_GET_CLASS (page);
        extension_name = class->extension_name;
@@ -379,6 +380,15 @@ mail_config_remote_backend_insert_widgets (EMailConfigServiceBackend *backend,
                remote_backend->auth_check, "active-mechanism",
                G_BINDING_BIDIRECTIONAL);
 
+       if (!existing_source) {
+               /* Default to TLS for new accounts */
+               g_object_set (G_OBJECT (settings),
+                       "security-method", CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT,
+                       NULL);
+       }
+
+       g_clear_object (&existing_source);
+
        e_source_lookup_password (source, remote_backend->cancellable, source_lookup_password_done, 
remote_backend);
 }
 
diff --git a/src/modules/mail-config/e-mail-config-smtp-backend.c 
b/src/modules/mail-config/e-mail-config-smtp-backend.c
index f74ae2fdc7..9419ecb03d 100644
--- a/src/modules/mail-config/e-mail-config-smtp-backend.c
+++ b/src/modules/mail-config/e-mail-config-smtp-backend.c
@@ -126,7 +126,7 @@ mail_config_smtp_backend_insert_widgets (EMailConfigServiceBackend *backend,
        EMailConfigSmtpBackendPrivate *priv;
        CamelProvider *provider;
        CamelSettings *settings;
-       ESource *source;
+       ESource *source, *existing_source;
        ESourceBackend *extension;
        EMailConfigServicePage *page;
        EMailConfigServicePageClass *class;
@@ -145,6 +145,7 @@ mail_config_smtp_backend_insert_widgets (EMailConfigServiceBackend *backend,
        page = e_mail_config_service_backend_get_page (backend);
        source = e_mail_config_service_backend_get_source (backend);
        settings = e_mail_config_service_backend_get_settings (backend);
+       existing_source = e_source_registry_ref_source (e_mail_config_service_page_get_registry (page), 
e_source_get_uid (source));
 
        class = E_MAIL_CONFIG_SERVICE_PAGE_GET_CLASS (page);
        extension_name = class->extension_name;
@@ -380,6 +381,15 @@ mail_config_smtp_backend_insert_widgets (EMailConfigServiceBackend *backend,
                GTK_TOGGLE_BUTTON (priv->auth_required_toggle),
                (mechanism != NULL && *mechanism != '\0'));
 
+       if (!existing_source) {
+               /* Default to TLS for new accounts */
+               g_object_set (G_OBJECT (settings),
+                       "security-method", CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT,
+                       NULL);
+       }
+
+       g_clear_object (&existing_source);
+
        e_source_lookup_password (source, priv->cancellable, source_lookup_password_done, backend);
 }
 


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