From 0524f7c06a47544f26997da30317b35361c9d62b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sun, 30 Apr 2000 15:36:16 +0000 Subject: Tweak the definition of CamelProvider. Among other things, a provider may * camel-provider.h: Tweak the definition of CamelProvider. Among other things, a provider may now be both a store and a transport. * camel-provider.c: Remove a lot of code we had no intention of using. This now only contains two functions: camel_provider_init to read the installed .urls files, and camel_provider_load to load and register a new provider. * camel-session.c: Remove more unused code and simplify some of the remaining code. The list of available provider modules is now stored in the session, and it handles calling camel_provider_load to load them as needed. Provider registration is now done by calling back from the module init routine, which allows a single module to register providers for multiple URL types. * providers/*: Update provider structures and init routines for the new stuff. Add a .urls file to each provider specifying what urls it handles, and install that with the library. * providers/nntp/camel-nntp-provider.c: Add hints towards supporting both news: and nntp: URLs, and using nntp as both a store and a transport. svn path=/trunk/; revision=2691 --- camel/camel-session.h | 59 ++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'camel/camel-session.h') diff --git a/camel/camel-session.h b/camel/camel-session.h index 4bb51804ac..4eff6c94a3 100644 --- a/camel/camel-session.h +++ b/camel/camel-session.h @@ -1,15 +1,15 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* camel-session.h : Abstract class for an email session */ -/* +/* * - * Author : + * Author : * Bertrand Guiheneuf * * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * @@ -48,23 +48,17 @@ typedef char *(*CamelAuthCallback) (char *prompt, gboolean secret, CamelService *service, char *item, CamelException *ex); - struct _CamelSession { GtkObject parent_object; CamelAuthCallback authenticator; - GHashTable *store_provider_list; /* providers are identified by their protocol */ - GHashTable *transport_provider_list; + GHashTable *providers, *modules; }; - - typedef struct { GtkObjectClass parent_class; - - /* Virtual methods */ } CamelSessionClass; @@ -72,24 +66,31 @@ typedef struct { /* public methods */ /* Standard Gtk function */ -GtkType camel_session_get_type (void); - - -CamelSession * camel_session_new (CamelAuthCallback authenticator); -void camel_session_set_provider (CamelSession *session, CamelProvider *provider); -CamelStore * camel_session_get_store_for_protocol (CamelSession *session, - const gchar *protocol, - CamelException *ex); -CamelStore * camel_session_get_store (CamelSession *session, - const char *url_string, - CamelException *ex); -CamelTransport * camel_session_get_transport_for_protocol (CamelSession *session, - const char *protocol, - CamelException *ex); -char * camel_session_query_authenticator (CamelSession *session, char *prompt, - gboolean secret, - CamelService *service, char *item, - CamelException *ex); +GtkType camel_session_get_type (void); + + +CamelSession * camel_session_new (CamelAuthCallback + authenticator); + +void camel_session_register_provider (CamelSession *session, + CamelProvider *provider); + +CamelService * camel_session_get_service (CamelSession *session, + const char *url_string, + CamelProviderType type, + CamelException *ex); +#define camel_session_get_store(session, url_string, ex) \ + ((CamelStore *) camel_session_get_service (session, url_string, CAMEL_PROVIDER_STORE, ex)) +#define camel_session_get_transport(session, url_string, ex) \ + ((CamelTransport *) camel_session_get_service (session, url_string, CAMEL_PROVIDER_TRANSPORT, ex)) + + +char * camel_session_query_authenticator (CamelSession *session, + char *prompt, + gboolean secret, + CamelService *service, + char *item, + CamelException *ex); #ifdef __cplusplus } -- cgit v1.2.3