diff options
author | Dan Winship <danw@src.gnome.org> | 2001-03-22 06:20:29 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-03-22 06:20:29 +0800 |
commit | 5d562c3d3d879d05c75ecb300c53e0b5ae0120fc (patch) | |
tree | 6ca10894c653240c1be004faf130ffddf6511b9b /camel/providers/smtp | |
parent | 0ec6ccc4dfc136dd7347e49e4dc2b309126706a9 (diff) | |
download | gsoc2013-evolution-5d562c3d3d879d05c75ecb300c53e0b5ae0120fc.tar gsoc2013-evolution-5d562c3d3d879d05c75ecb300c53e0b5ae0120fc.tar.gz gsoc2013-evolution-5d562c3d3d879d05c75ecb300c53e0b5ae0120fc.tar.bz2 gsoc2013-evolution-5d562c3d3d879d05c75ecb300c53e0b5ae0120fc.tar.lz gsoc2013-evolution-5d562c3d3d879d05c75ecb300c53e0b5ae0120fc.tar.xz gsoc2013-evolution-5d562c3d3d879d05c75ecb300c53e0b5ae0120fc.tar.zst gsoc2013-evolution-5d562c3d3d879d05c75ecb300c53e0b5ae0120fc.zip |
add a "GList *authtypes", so you can get the list of authtypes used by a
* camel-provider.h: (CamelProvider) add a "GList *authtypes", so
you can get the list of authtypes used by a provider without
needing to have an actual CamelService object handy. (Will be
needed by the new config druid.)
(CAMEL_PROVIDER_ALLOWS, CAMEL_PROVIDER_NEEDS): New macros to test
the URL part stuff, since the way it works is too complicated and
everyone always does it wrong.
* camel-service.c (camel_service_query_auth_types): Remove the
@connected arg again: if you don't want to connect, you can just
get the list of authtypes off the provider.
(camel_service_free_auth_types): Remove this. All existing
implementations do authtypes the same way, so just say the caller
should "g_list_free" the list. (Oh, look, removing this function
doesn't actually cause the mailer to not build. How 'bout that.)
(construct, get_path): Use the new URL part macros.
* camel-remote-store.c (remote_query_auth_types): Update
(remote_free_auth_types): Nuke
(camel_remote_store_authtype_list): New function for use by
subclasses.
* providers/imap/camel-imap-provider.c:
* providers/pop3/camel-pop3-provider.c:
* providers/smtp/camel-smtp-provider.c: Update CamelProvider
structures.
(camel_provider_module_init): Put all the SSL parts together so
there's only 1 #ifdef. Set up the provider authtypes field using
the SASL, CamelRemoteStore, and standard authtypes, as
appropriate. Copy that from the normal provider to the SSL
provider.
* providers/local/camel-local-provider.c:
* providers/sendmail/camel-sendmail-provider.c:
* camel-session.c: Update CamelProvider structures.
* providers/imap/camel-imap-store.c (query_auth_types):
* providers/pop3/camel-pop3-store.c (query_auth_types): Update
* providers/smtp/camel-smtp-store.c (query_auth_types): Update.
Remove the no_authtype, because that's what "ALLOW_AUTH" rather
than "NEED_AUTH" means.
(free_auth_types): Nuke.
svn path=/trunk/; revision=8872
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 * |