From ddfc033633f5db2c7f2c1a4de179d9029cbf1a6f Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 5 Feb 2001 19:55:54 +0000 Subject: Updated. 2001-02-05 Jeffrey Stedfast * providers/smtp/camel-smtp-transport.c (query_auth_types): Updated. * providers/nntp/camel-nntp-store.c (nntp_store_query_auth_types): Updated. * providers/pop3/camel-pop3-store.c (query_auth_types): Updated. * providers/imap/camel-imap-store.c (query_auth_types): Updated. * camel-service.c (camel_service_query_auth_types): Now takes a boolean value to specify whether or not to connect when constructing a supported authtype list. svn path=/trunk/; revision=7979 --- camel/providers/pop3/camel-pop3-store.c | 88 +++++++++++++++++---------------- 1 file changed, 46 insertions(+), 42 deletions(-) (limited to 'camel/providers/pop3/camel-pop3-store.c') diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c index be59964b74..aefabebfa4 100644 --- a/camel/providers/pop3/camel-pop3-store.c +++ b/camel/providers/pop3/camel-pop3-store.c @@ -70,7 +70,7 @@ static void finalize (CamelObject *object); static gboolean pop3_connect (CamelService *service, CamelException *ex); static gboolean pop3_disconnect (CamelService *service, gboolean clean, CamelException *ex); -static GList *query_auth_types (CamelService *service, CamelException *ex); +static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex); static CamelFolder *get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex); @@ -284,59 +284,63 @@ connect_to_server (CamelService *service, /*gboolean real, */CamelException *ex) } static GList * -query_auth_types (CamelService *service, CamelException *ex) +query_auth_types (CamelService *service, gboolean connect, CamelException *ex) { CamelPop3Store *store = CAMEL_POP3_STORE (service); - GList *ret = NULL; + GList *types = NULL; gboolean passwd = TRUE, apop = TRUE; #ifdef HAVE_KRB4 gboolean kpop = TRUE; int saved_port; #endif - - ret = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, ex); - - passwd = camel_service_connect (service, ex); - /*ignore the exception here; the server may just not support passwd */ - /*if (camel_exception_is_set (ex) != CAMEL_EXCEPTION_NONE)*/ - /*return NULL;*/ - /* should we check apop too? */ - apop = store->apop_timestamp != NULL; - if (passwd) - camel_service_disconnect (service, TRUE, ex); - camel_exception_clear (ex); - + types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, connect, ex); + + if (connect) { + passwd = camel_service_connect (service, ex); + /*ignore the exception here; the server may just not support passwd */ + + /* should we check apop too? */ + apop = store->apop_timestamp != NULL; + if (passwd) + camel_service_disconnect (service, TRUE, ex); + camel_exception_clear (ex); + #ifdef HAVE_KRB4 - saved_port = service->url->port; - service->url->port = KPOP_PORT; - kpop = camel_service_connect (service, ex); - service->url->port = saved_port; - /*ignore the exception here; the server may just not support kpop */ - /*if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)*/ - /*return NULL;*/ - - if (kpop) - camel_service_disconnect (service, TRUE, ex); - camel_exception_clear (ex); + saved_port = service->url->port; + service->url->port = KPOP_PORT; + kpop = camel_service_connect (service, ex); + service->url->port = saved_port; + /*ignore the exception here; the server may just not support kpop */ + + if (kpop) + camel_service_disconnect (service, TRUE, ex); + camel_exception_clear (ex); #endif - - if (passwd) - ret = g_list_append (ret, &password_authtype); - if (apop) - ret = g_list_append (ret, &apop_authtype); + + if (passwd) + types = g_list_append (types, &password_authtype); + if (apop) + types = g_list_append (types, &apop_authtype); #ifdef HAVE_KRB4 - if (kpop) - ret = g_list_append (ret, &kpop_authtype); + if (kpop) + types = g_list_append (types, &kpop_authtype); #endif - - if (!ret) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, - _("Could not connect to POP server on " - "%s."), service->url->host); - } - - return ret; + + if (!types) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, + _("Could not connect to POP server on " + "%s."), service->url->host); + } + } else { + types = g_list_append (types, &password_authtype); + types = g_list_append (types, &apop_authtype); +#ifdef HAVE_KRB4 + types = g_list_append (types, &kpop_authtype); +#endif + } + + return types; } /** -- cgit v1.2.3