From 0d54c483525a76d4eedd41b9e5f59c241139bed3 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 9 Jan 2001 19:27:27 +0000 Subject: Kill off a long-hated Camel kludge: "empty" URLs and query_auth_types_generic. * camel-url.c: Remove "empty" from CamelURL. (camel_url_new): No longer set it. (camel_url_to_string): Treat "" as equivalent to NULL for authmech. (Unrelated change, but it simplifies some stuff with the new config dialog.) * camel-service.c (camel_service_new): Remove url->empty check: if the URL isn't valid, we don't create the service. (camel_service_query_auth_types): No longer need to switch between generic and connected variants. * providers/smtp/camel-smtp-transport.c (query_auth_types): * providers/pop3/camel-pop3-store.c (query_auth_types): * providers/nntp/camel-nntp-store.c (nntp_store_query_auth_types): * providers/imap/camel-imap-store.c (query_auth_types): * camel-remote-store.c (remote_query_auth_types): Remove generic version, rename connected version. svn path=/trunk/; revision=7327 --- camel/ChangeLog | 23 +++++++++++++++++++++++ camel/camel-remote-store.c | 14 +++----------- camel/camel-service.c | 16 +++++----------- camel/camel-service.h | 6 ++---- camel/camel-url.c | 8 ++------ camel/camel-url.h | 3 --- camel/providers/imap/camel-imap-store.c | 22 ++++------------------ camel/providers/nntp/camel-nntp-store.c | 16 ++++------------ camel/providers/pop3/camel-pop3-store.c | 24 ++++-------------------- camel/providers/smtp/camel-smtp-transport.c | 18 +++--------------- 10 files changed, 50 insertions(+), 100 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 4e70ef551d..18263b19cd 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,26 @@ +2001-01-09 Dan Winship + + Kill off a long-hated Camel kludge: "empty" URLs and + query_auth_types_generic. + + * camel-url.c: Remove "empty" from CamelURL. + (camel_url_new): No longer set it. + (camel_url_to_string): Treat "" as equivalent to NULL for + authmech. (Unrelated change, but it simplifies some stuff with the + new config dialog.) + + * camel-service.c (camel_service_new): Remove url->empty check: if + the URL isn't valid, we don't create the service. + (camel_service_query_auth_types): No longer need to switch between + generic and connected variants. + + * providers/smtp/camel-smtp-transport.c (query_auth_types): + * providers/pop3/camel-pop3-store.c (query_auth_types): + * providers/nntp/camel-nntp-store.c (nntp_store_query_auth_types): + * providers/imap/camel-imap-store.c (query_auth_types): + * camel-remote-store.c (remote_query_auth_types): Remove generic + version, rename connected version. + 2001-01-06 Not Zed * providers/vee/camel-vee-folder.c (vee_folder_build_folder): Dont diff --git a/camel/camel-remote-store.c b/camel/camel-remote-store.c index 3436e41733..70b34ec1f2 100644 --- a/camel/camel-remote-store.c +++ b/camel/camel-remote-store.c @@ -62,8 +62,7 @@ static CamelStoreClass *store_class = NULL; static gboolean remote_connect (CamelService *service, CamelException *ex); static gboolean remote_disconnect (CamelService *service, gboolean clean, CamelException *ex); -static GList *remote_query_auth_types_generic (CamelService *service, CamelException *ex); -static GList *remote_query_auth_types_connected (CamelService *service, CamelException *ex); +static GList *remote_query_auth_types(CamelService *service, CamelException *ex); static void remote_free_auth_types (CamelService *service, GList *authtypes); static char *remote_get_name (CamelService *service, gboolean brief); static char *remote_get_folder_name (CamelStore *store, @@ -90,8 +89,7 @@ camel_remote_store_class_init (CamelRemoteStoreClass *camel_remote_store_class) /* virtual method overload */ camel_service_class->connect = remote_connect; camel_service_class->disconnect = remote_disconnect; - camel_service_class->query_auth_types_generic = remote_query_auth_types_generic; - camel_service_class->query_auth_types_connected = remote_query_auth_types_connected; + camel_service_class->query_auth_types = remote_query_auth_types; camel_service_class->free_auth_types = remote_free_auth_types; camel_service_class->get_name = remote_get_name; @@ -167,13 +165,7 @@ static CamelServiceAuthType password_authtype = { */ static GList * -remote_query_auth_types_connected (CamelService *service, CamelException *ex) -{ - return NULL; -} - -static GList * -remote_query_auth_types_generic (CamelService *service, CamelException *ex) +remote_query_auth_types (CamelService *service, CamelException *ex) { return NULL; } diff --git a/camel/camel-service.c b/camel/camel-service.c index 6a14327b92..46de098e7a 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -42,7 +42,7 @@ static gboolean service_connect(CamelService *service, CamelException *ex); static gboolean service_disconnect(CamelService *service, gboolean clean, CamelException *ex); /*static gboolean is_connected (CamelService *service);*/ -static GList * query_auth_types_func (CamelService *service, CamelException *ex); +static GList * query_auth_types (CamelService *service, CamelException *ex); static void free_auth_types (CamelService *service, GList *authtypes); static char * get_name (CamelService *service, gboolean brief); static char * get_path (CamelService *service); @@ -58,8 +58,7 @@ camel_service_class_init (CamelServiceClass *camel_service_class) camel_service_class->connect = service_connect; camel_service_class->disconnect = service_disconnect; /*camel_service_class->is_connected = is_connected;*/ - camel_service_class->query_auth_types_connected = query_auth_types_func; - camel_service_class->query_auth_types_generic = query_auth_types_func; + 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_service_class->get_path = get_path; @@ -190,7 +189,7 @@ camel_service_new (CamelType type, CamelSession *session, service->provider = provider; service->url = url; - if (!url->empty && !check_url (service, ex)) { + if (!check_url (service, ex)) { camel_object_unref (CAMEL_OBJECT (service)); return NULL; } @@ -430,7 +429,7 @@ camel_service_get_provider (CamelService *service) } GList * -query_auth_types_func (CamelService *service, CamelException *ex) +query_auth_types (CamelService *service, CamelException *ex) { return NULL; } @@ -462,12 +461,7 @@ camel_service_query_auth_types (CamelService *service, CamelException *ex) /* note that we get the connect lock here, which means the callee must not call the connect functions itself */ CAMEL_SERVICE_LOCK(service, connect_lock); - - if (service->url->empty) - ret = CSERV_CLASS (service)->query_auth_types_generic (service, ex); - else - ret = CSERV_CLASS (service)->query_auth_types_connected (service, ex); - + ret = CSERV_CLASS (service)->query_auth_types (service, ex); CAMEL_SERVICE_UNLOCK(service, connect_lock); return ret; diff --git a/camel/camel-service.h b/camel/camel-service.h index 7ba07a66e9..397291baa5 100644 --- a/camel/camel-service.h +++ b/camel/camel-service.h @@ -67,10 +67,8 @@ typedef struct { /*gboolean (*is_connected) (CamelService *service);*/ - GList * (*query_auth_types_connected) (CamelService *service, - CamelException *ex); - GList * (*query_auth_types_generic) (CamelService *service, - CamelException *ex); + GList * (*query_auth_types) (CamelService *service, + CamelException *ex); void (*free_auth_types) (CamelService *service, GList *authtypes); diff --git a/camel/camel-url.c b/camel/camel-url.c index 18575782dc..337243bb55 100644 --- a/camel/camel-url.c +++ b/camel/camel-url.c @@ -59,9 +59,6 @@ * * The port, if present, must be numeric. * - * If nothing but the protocol (and the ":") is present, the "empty" - * flag will be set on the returned URL. - * * Return value: a CamelURL structure containing the URL items. **/ CamelURL * @@ -101,8 +98,7 @@ camel_url_new (const char *url_string, CamelException *ex) if (*(colon + 1)) { url->path = g_strdup (colon + 1); camel_url_decode (url->path); - } else - url->empty = TRUE; + } return url; } @@ -185,7 +181,7 @@ camel_url_to_string (CamelURL *url, gboolean show_passwd) if (url->user) user = camel_url_encode (url->user, TRUE, ":;@/"); - if (url->authmech) + if (url->authmech && *url->authmech) authmech = camel_url_encode (url->authmech, TRUE, ":@/"); if (show_passwd && url->passwd) diff --git a/camel/camel-url.h b/camel/camel-url.h index aba903c08b..996c4b4e74 100644 --- a/camel/camel-url.h +++ b/camel/camel-url.h @@ -44,9 +44,6 @@ typedef struct { char *host; int port; char *path; - - /* This is set if the URL contained only a protocol. */ - gboolean empty; } CamelURL; CamelURL *camel_url_new (const char *url_string, CamelException *ex); diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 8774d783bd..7b3691efe6 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -58,8 +58,7 @@ static CamelRemoteStoreClass *remote_store_class = NULL; static gboolean imap_connect (CamelService *service, CamelException *ex); static gboolean imap_disconnect (CamelService *service, gboolean clean, CamelException *ex); -static GList *query_auth_types_generic (CamelService *service, CamelException *ex); -static GList *query_auth_types_connected (CamelService *service, CamelException *ex); +static GList *query_auth_types (CamelService *service, CamelException *ex); static CamelFolder *get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex); static char *get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex); @@ -90,8 +89,7 @@ camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class) (camel_remote_store_get_type ())); /* virtual method overload */ - camel_service_class->query_auth_types_generic = query_auth_types_generic; - camel_service_class->query_auth_types_connected = query_auth_types_connected; + camel_service_class->query_auth_types = query_auth_types; camel_service_class->connect = imap_connect; camel_service_class->disconnect = imap_disconnect; @@ -265,14 +263,14 @@ static CamelServiceAuthType kerberos_v4_authtype = { #endif static GList * -query_auth_types_connected (CamelService *service, CamelException *ex) +query_auth_types (CamelService *service, CamelException *ex) { GList *types; if (!connect_to_server (service, ex)) return NULL; - types = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types_connected (service, ex); + types = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, ex); #ifdef HAVE_KRB4 if (CAMEL_IMAP_STORE (service)->capabilities & IMAP_CAPABILITY_AUTH_KERBEROS_V4) @@ -281,18 +279,6 @@ query_auth_types_connected (CamelService *service, CamelException *ex) return g_list_prepend (types, &password_authtype); } -static GList * -query_auth_types_generic (CamelService *service, CamelException *ex) -{ - GList *types; - - types = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types_generic (service, ex); -#ifdef HAVE_KRB4 - types = g_list_prepend (types, &kerberos_v4_authtype); -#endif - return g_list_prepend (types, &password_authtype); -} - static gboolean imap_connect (CamelService *service, CamelException *ex) { diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c index ff9e7a989a..a3f6926a2a 100644 --- a/camel/providers/nntp/camel-nntp-store.c +++ b/camel/providers/nntp/camel-nntp-store.c @@ -300,22 +300,15 @@ static CamelServiceAuthType password_authtype = { }; static GList * -nntp_store_query_auth_types_generic (CamelService *service, CamelException *ex) +nntp_store_query_auth_types (CamelService *service, CamelException *ex) { GList *prev; - prev = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types_generic (service, ex); + g_warning ("nntp::query_auth_types: not implemented. Defaulting."); + prev = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, ex); return g_list_prepend (prev, &password_authtype); } -static GList * -nntp_store_query_auth_types_connected (CamelService *service, CamelException *ex) -{ - g_warning ("nntp::query_auth_types_connected: not implemented. Defaulting."); - /* FIXME: use the classfunc instead of the local? */ - return nntp_store_query_auth_types_generic (service, ex); -} - static CamelFolder * nntp_store_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelException *ex) @@ -607,8 +600,7 @@ camel_nntp_store_class_init (CamelNNTPStoreClass *camel_nntp_store_class) /* virtual method overload */ camel_service_class->connect = nntp_store_connect; camel_service_class->disconnect = nntp_store_disconnect; - camel_service_class->query_auth_types_generic = nntp_store_query_auth_types_generic; - camel_service_class->query_auth_types_connected = nntp_store_query_auth_types_connected; + camel_service_class->query_auth_types = nntp_store_query_auth_types; camel_service_class->get_name = nntp_store_get_name; camel_store_class->get_folder = nntp_store_get_folder; diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c index 6fc56fc125..be59964b74 100644 --- a/camel/providers/pop3/camel-pop3-store.c +++ b/camel/providers/pop3/camel-pop3-store.c @@ -70,8 +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_connected (CamelService *service, CamelException *ex); -static GList *query_auth_types_generic (CamelService *service, CamelException *ex); +static GList *query_auth_types (CamelService *service, CamelException *ex); static CamelFolder *get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex); @@ -97,8 +96,7 @@ camel_pop3_store_class_init (CamelPop3StoreClass *camel_pop3_store_class) (camel_remote_store_get_type ())); /* virtual method overload */ - camel_service_class->query_auth_types_connected = query_auth_types_connected; - camel_service_class->query_auth_types_generic = query_auth_types_generic; + camel_service_class->query_auth_types = query_auth_types; camel_service_class->connect = pop3_connect; camel_service_class->disconnect = pop3_disconnect; @@ -286,7 +284,7 @@ connect_to_server (CamelService *service, /*gboolean real, */CamelException *ex) } static GList * -query_auth_types_connected (CamelService *service, CamelException *ex) +query_auth_types (CamelService *service, CamelException *ex) { CamelPop3Store *store = CAMEL_POP3_STORE (service); GList *ret = NULL; @@ -296,7 +294,7 @@ query_auth_types_connected (CamelService *service, CamelException *ex) int saved_port; #endif - ret = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types_connected (service, ex); + 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 */ @@ -341,20 +339,6 @@ query_auth_types_connected (CamelService *service, CamelException *ex) return ret; } -static GList * -query_auth_types_generic (CamelService *service, CamelException *ex) -{ - GList *ret; - - ret = g_list_append (NULL, &password_authtype); - ret = g_list_append (ret, &apop_authtype); -#ifdef HAVE_KRB4 - ret = g_list_append (ret, &kpop_authtype); -#endif - - return ret; -} - /** * camel_pop3_store_expunge: * @store: the store diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 2d20cadce8..1176cca454 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -63,8 +63,7 @@ static gboolean _send_to (CamelTransport *transport, CamelMedium *message, GList static gboolean smtp_connect (CamelService *service, CamelException *ex); static gboolean smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex); static GList *esmtp_get_authtypes(gchar *buffer); -static GList *query_auth_types_connected (CamelService *service, CamelException *ex); -static GList *query_auth_types_generic (CamelService *service, CamelException *ex); +static GList *query_auth_types (CamelService *service, CamelException *ex); static void free_auth_types (CamelService *service, GList *authtypes); static char *get_name (CamelService *service, gboolean brief); @@ -93,8 +92,7 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c /* virtual method overload */ camel_service_class->connect = smtp_connect; camel_service_class->disconnect = smtp_disconnect; - camel_service_class->query_auth_types_generic = query_auth_types_generic; - camel_service_class->query_auth_types_connected = query_auth_types_connected; + 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; @@ -300,17 +298,7 @@ static CamelServiceAuthType cram_md5_authtype = { #endif static GList * -query_auth_types_connected (CamelService *service, CamelException *ex) -{ - /* FIXME: Re-enable this when auth types are actually - * implemented. - */ - - return NULL; -} - -static GList * -query_auth_types_generic (CamelService *service, CamelException *ex) +query_auth_types (CamelService *service, CamelException *ex) { /* FIXME: Re-enable this when auth types are actually * implemented. -- cgit