[evolution-data-server] [SMTP] Change how the list of available authentication methods is constructed



commit 4963283ad8c144a6daab0d24ba1c404bb1c8d61f
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 24 08:58:48 2018 +0100

    [SMTP] Change how the list of available authentication methods is constructed

 src/camel/providers/smtp/camel-smtp-transport.c |   29 ++++++++--------------
 1 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/src/camel/providers/smtp/camel-smtp-transport.c b/src/camel/providers/smtp/camel-smtp-transport.c
index 7810be4..7c331cf 100644
--- a/src/camel/providers/smtp/camel-smtp-transport.c
+++ b/src/camel/providers/smtp/camel-smtp-transport.c
@@ -830,35 +830,28 @@ smtp_transport_query_auth_types_sync (CamelService *service,
                                       GError **error)
 {
        CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
-       CamelServiceAuthType *authtype;
-       CamelProvider *provider;
-       GList *types, *t, *next;
+       GList *sasl_types = NULL;
 
        if (!connect_to_server (service, cancellable, error))
                return NULL;
 
-       if (!transport->authtypes) {
-               smtp_transport_disconnect_sync (
-                       service, TRUE, cancellable, NULL);
-               return NULL;
-       }
-
-       provider = camel_service_get_provider (service);
-       types = g_list_copy (provider->authtypes);
+       if (transport->authtypes) {
+               GHashTableIter iter;
+               gpointer key;
 
-       for (t = types; t; t = next) {
-               authtype = t->data;
-               next = t->next;
+               g_hash_table_iter_init (&iter, transport->authtypes);
+               while (g_hash_table_iter_next (&iter, &key, NULL)) {
+                       CamelServiceAuthType *auth_type;
 
-               if (!g_hash_table_lookup (transport->authtypes, authtype->authproto)) {
-                       types = g_list_remove_link (types, t);
-                       g_list_free_1 (t);
+                       auth_type = camel_sasl_authtype (key);
+                       if (auth_type)
+                               sasl_types = g_list_prepend (sasl_types, auth_type);
                }
        }
 
        smtp_transport_disconnect_sync (service, TRUE, cancellable, NULL);
 
-       return types;
+       return sasl_types;
 }
 
 static gboolean


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