1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-service.h : Abstract class for an email service */
7 * Bertrand Guiheneuf <bertrand@helixcode.com>
9 * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28 #ifndef CAMEL_SERVICE_H
29 #define CAMEL_SERVICE_H 1
35 #endif /* __cplusplus }*/
38 #include <camel/camel-object.h>
39 #include <camel/camel-url.h>
40 #include <camel/camel-provider.h>
42 #define CAMEL_SERVICE_TYPE (camel_service_get_type ())
43 #define CAMEL_SERVICE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
44 #define CAMEL_SERVICE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SERVICE_TYPE, CamelServiceClass))
45 #define CAMEL_IS_SERVICE(o) (CAMEL_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
48 struct _CamelService {
49 CamelObject parent_object;
50 struct _CamelServicePrivate *priv;
52 CamelSession *session;
53 CamelProvider *provider;
60 CamelObjectClass parent_class;
62 void (*construct) (CamelService *service,
63 CamelSession *session,
64 CamelProvider *provider,
68 gboolean (*connect) (CamelService *service,
70 gboolean (*disconnect) (CamelService *service,
74 GList * (*query_auth_types) (CamelService *service,
77 char * (*get_name) (CamelService *service,
79 char * (*get_path) (CamelService *service);
84 /* query_auth_types returns a GList of these */
86 char *name; /* user-friendly name */
90 gboolean need_password; /* needs a password to authenticate */
92 gboolean quick_login; /* client can send initial challenge to
93 * speed up the authentication procedure */
94 } CamelServiceAuthType;
98 void camel_service_construct (CamelService *service,
99 CamelSession *session,
100 CamelProvider *provider,
103 gboolean camel_service_connect (CamelService *service,
105 gboolean camel_service_disconnect (CamelService *service,
108 char * camel_service_get_url (CamelService *service);
109 char * camel_service_get_name (CamelService *service,
111 char * camel_service_get_path (CamelService *service);
112 CamelSession * camel_service_get_session (CamelService *service);
113 CamelProvider * camel_service_get_provider (CamelService *service);
114 GList * camel_service_query_auth_types (CamelService *service,
117 /* convenience functions */
118 struct hostent * camel_service_gethost (CamelService *service,
121 /* cancellable dns lookup */
122 struct hostent * camel_get_host_byname (const char *name, CamelException *ex);
123 void camel_free_host (struct hostent *h);
125 /* Standard Camel function */
126 CamelType camel_service_get_type (void);
130 #endif /* __cplusplus */
132 #endif /* CAMEL_SERVICE_H */