From 5d562c3d3d879d05c75ecb300c53e0b5ae0120fc Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 21 Mar 2001 22:20:29 +0000 Subject: 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 --- camel/camel-provider.h | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'camel/camel-provider.h') diff --git a/camel/camel-provider.h b/camel/camel-provider.h index 07d62106ea..4936a77a0e 100644 --- a/camel/camel-provider.h +++ b/camel/camel-provider.h @@ -62,22 +62,37 @@ extern char *camel_provider_type_name[CAMEL_NUM_PROVIDER_TYPES]; * for which it has set the NEED flag will be set when the service * is created. */ -#define CAMEL_URL_ALLOW_USER (1 << 0) -#define CAMEL_URL_ALLOW_AUTH (1 << 1) -#define CAMEL_URL_ALLOW_PASSWORD (1 << 2) -#define CAMEL_URL_ALLOW_HOST (1 << 3) -#define CAMEL_URL_ALLOW_PORT (1 << 4) -#define CAMEL_URL_ALLOW_PATH (1 << 5) - -#define CAMEL_URL_NEED_USER (1 << 6 | 1 << 0) -#define CAMEL_URL_NEED_AUTH (1 << 7 | 1 << 1) -#define CAMEL_URL_NEED_PASSWORD (1 << 8 | 1 << 2) -#define CAMEL_URL_NEED_HOST (1 << 9 | 1 << 3) -#define CAMEL_URL_NEED_PORT (1 << 10 | 1 << 4) -#define CAMEL_URL_NEED_PATH (1 << 11 | 1 << 5) +#define CAMEL_URL_PART_USER (1 << 0) +#define CAMEL_URL_PART_AUTH (1 << 1) +#define CAMEL_URL_PART_PASSWORD (1 << 2) +#define CAMEL_URL_PART_HOST (1 << 3) +#define CAMEL_URL_PART_PORT (1 << 4) +#define CAMEL_URL_PART_PATH (1 << 5) + +#define CAMEL_URL_PART_NEED 6 + +/* Use these macros to test a provider's url_flags */ +#define CAMEL_PROVIDER_ALLOWS(prov, flags) (prov->url_flags & (flags | (flags << CAMEL_URL_PART_NEED))) +#define CAMEL_PROVIDER_NEEDS(prov, flags) (prov->url_flags & (flags << CAMEL_URL_PART_NEED)) + +/* Providers use these macros to actually define their url_flags */ +#define CAMEL_URL_ALLOW_USER (CAMEL_URL_PART_USER) +#define CAMEL_URL_ALLOW_AUTH (CAMEL_URL_PART_AUTH) +#define CAMEL_URL_ALLOW_PASSWORD (CAMEL_URL_PART_PASSWORD) +#define CAMEL_URL_ALLOW_HOST (CAMEL_URL_PART_HOST) +#define CAMEL_URL_ALLOW_PORT (CAMEL_URL_PART_PORT) +#define CAMEL_URL_ALLOW_PATH (CAMEL_URL_PART_PATH) + +#define CAMEL_URL_NEED_USER (CAMEL_URL_PART_USER << CAMEL_URL_PART_NEED) +#define CAMEL_URL_NEED_AUTH (CAMEL_URL_PART_AUTH << CAMEL_URL_PART_NEED) +#define CAMEL_URL_NEED_PASSWORD (CAMEL_URL_PART_PASSWORD << CAMEL_URL_PART_NEED) +#define CAMEL_URL_NEED_HOST (CAMEL_URL_PART_HOST << CAMEL_URL_PART_NEED) +#define CAMEL_URL_NEED_PORT (CAMEL_URL_PART_PORT << CAMEL_URL_PART_NEED) +#define CAMEL_URL_NEED_PATH (CAMEL_URL_PART_PATH << CAMEL_URL_PART_NEED) #define CAMEL_URL_PATH_IS_ABSOLUTE (1 << 12) + typedef struct { /* Provider name used in CamelURLs. */ char *protocol; @@ -99,10 +114,14 @@ typedef struct { */ char *domain; + /* Flags describing the provider, flags describing its URLs */ int flags, url_flags; CamelType object_types [CAMEL_NUM_PROVIDER_TYPES]; + /* GList of CamelServiceAuthTypes the provider supports */ + GList *authtypes; + GHashTable *service_cache; } CamelProvider; -- cgit v1.2.3