diff options
Diffstat (limited to 'camel/providers/smtp')
-rw-r--r-- | camel/providers/smtp/camel-smtp-provider.c | 25 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 44 |
2 files changed, 22 insertions, 47 deletions
diff --git a/camel/providers/smtp/camel-smtp-provider.c b/camel/providers/smtp/camel-smtp-provider.c index ec173ac5e8..a3905daa02 100644 --- a/camel/providers/smtp/camel-smtp-provider.c +++ b/camel/providers/smtp/camel-smtp-provider.c @@ -28,6 +28,7 @@ #include "camel-provider.h" #include "camel-session.h" #include "camel-url.h" +#include "camel-sasl.h" static CamelProvider smtp_provider = { "smtp", @@ -42,9 +43,7 @@ static CamelProvider smtp_provider = { CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH, - { 0, 0 }, - - NULL + /* ... */ }; #if defined (HAVE_NSS) || defined (HAVE_OPENSSL) @@ -61,9 +60,7 @@ static CamelProvider ssmtp_provider = { CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH, - { 0, 0 }, - - NULL + /* ... */ }; #endif @@ -72,19 +69,17 @@ camel_provider_module_init (CamelSession *session) { smtp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = camel_smtp_transport_get_type (); -#if defined (HAVE_NSS) || defined (HAVE_OPENSSL) - ssmtp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = - camel_smtp_transport_get_type (); -#endif - + smtp_provider.authtypes = camel_sasl_authtype_list (); smtp_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal); -#if defined (HAVE_NSS) || defined (HAVE_OPENSSL) - ssmtp_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal); -#endif - camel_session_register_provider (session, &smtp_provider); + #if defined (HAVE_NSS) || defined (HAVE_OPENSSL) + ssmtp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = + camel_smtp_transport_get_type (); + ssmtp_provider.authtypes = camel_sasl_authtype_list (); + ssmtp_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal); + camel_session_register_provider (session, &ssmtp_provider); #endif } diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 9d60891f04..9a6ae102bf 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -70,8 +70,7 @@ static gboolean smtp_send_to (CamelTransport *transport, CamelMedium *message, G static gboolean smtp_connect (CamelService *service, CamelException *ex); static gboolean smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex); static GHashTable *esmtp_get_authtypes (gchar *buffer); -static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex); -static void free_auth_types (CamelService *service, GList *authtypes); +static GList *query_auth_types (CamelService *service, CamelException *ex); static char *get_name (CamelService *service, gboolean brief); static gboolean smtp_helo (CamelSmtpTransport *transport, CamelException *ex); @@ -101,7 +100,6 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c camel_service_class->connect = smtp_connect; camel_service_class->disconnect = smtp_disconnect; camel_service_class->query_auth_types = query_auth_types; - camel_service_class->free_auth_types = free_auth_types; camel_service_class->get_name = get_name; camel_transport_class->can_send = smtp_can_send; @@ -465,46 +463,28 @@ esmtp_get_authtypes (char *buffer) return table; } -static CamelServiceAuthType no_authtype = { - N_("No authentication required"), - - N_("This option will connect to the SMTP server without using any " - "kind of authentication. This should be fine for connecting to " - "most SMTP servers."), - - "", - FALSE -}; - static GList * -query_auth_types (CamelService *service, gboolean connect, CamelException *ex) +query_auth_types (CamelService *service, CamelException *ex) { CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service); CamelServiceAuthType *authtype; - GList *types, *t; + GList *types, *t, *next; - if (connect && !smtp_connect (service, ex)) + if (!smtp_connect (service, ex)) return NULL; types = camel_sasl_authtype_list (); - if (connect) { - for (t = types; t; t = t->next) { - authtype = t->data; - - if (!g_hash_table_lookup (transport->authtypes, authtype->authproto)) { - g_list_remove_link (types, t); - g_list_free_1 (t); - } + for (t = types; t; t = next) { + authtype = t->data; + next = t->next; + + if (!g_hash_table_lookup (transport->authtypes, authtype->authproto)) { + types = g_list_remove_link (types, t); + g_list_free_1 (t); } } - return g_list_prepend (types, &no_authtype); -} - -static void -free_auth_types (CamelService *service, GList *authtypes) -{ - g_list_free (authtypes); + return types; } static char * |