1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-service.h : Abstract class for an email service */
5 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
6 * Michael Zucchi <notzed@ximian.com>
8 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU Lesser General Public
12 * License as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
25 #ifndef CAMEL_SERVICE_H
26 #define CAMEL_SERVICE_H 1
28 #include <camel/camel-object.h>
29 #include <camel/camel-url.h>
30 #include <camel/camel-provider.h>
31 #include <camel/camel-operation.h>
33 #define CAMEL_SERVICE_TYPE (camel_service_get_type ())
34 #define CAMEL_SERVICE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
35 #define CAMEL_SERVICE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_SERVICE_TYPE, CamelServiceClass))
36 #define CAMEL_IS_SERVICE(o) (CAMEL_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
41 CAMEL_SERVICE_ARG_FIRST = CAMEL_ARG_FIRST + 100,
42 CAMEL_SERVICE_ARG_USERNAME,
43 CAMEL_SERVICE_ARG_AUTH,
44 CAMEL_SERVICE_ARG_HOSTNAME,
45 CAMEL_SERVICE_ARG_PORT,
46 CAMEL_SERVICE_ARG_PATH
49 #define CAMEL_SERVICE_USERNAME (CAMEL_SERVICE_ARG_USERNAME | CAMEL_ARG_STR)
50 #define CAMEL_SERVICE_AUTH (CAMEL_SERVICE_ARG_AUTH | CAMEL_ARG_STR)
51 #define CAMEL_SERVICE_HOSTNAME (CAMEL_SERVICE_ARG_HOSTNAME | CAMEL_ARG_STR)
52 #define CAMEL_SERVICE_PORT (CAMEL_SERVICE_ARG_PORT | CAMEL_ARG_INT)
53 #define CAMEL_SERVICE_PATH (CAMEL_SERVICE_ARG_PATH | CAMEL_ARG_STR)
56 CAMEL_SERVICE_DISCONNECTED,
57 CAMEL_SERVICE_CONNECTING,
58 CAMEL_SERVICE_CONNECTED,
59 CAMEL_SERVICE_DISCONNECTING
60 } CamelServiceConnectionStatus;
62 struct _CamelService {
63 CamelObject parent_object;
64 struct _CamelServicePrivate *priv;
66 CamelSession *session;
67 CamelProvider *provider;
68 CamelServiceConnectionStatus status;
69 CamelOperation *connect_op;
74 CamelObjectClass parent_class;
76 void (*construct) (CamelService *service,
77 CamelSession *session,
78 CamelProvider *provider,
82 gboolean (*connect) (CamelService *service,
84 gboolean (*disconnect) (CamelService *service,
87 void (*cancel_connect) (CamelService *service);
89 GList * (*query_auth_types) (CamelService *service,
92 gchar * (*get_name) (CamelService *service,
94 gchar * (*get_path) (CamelService *service);
98 /* query_auth_types returns a GList of these */
100 gchar *name; /* user-friendly name */
104 gboolean need_password; /* needs a password to authenticate */
105 } CamelServiceAuthType;
108 void camel_service_construct (CamelService *service,
109 CamelSession *session,
110 CamelProvider *provider,
113 gboolean camel_service_connect (CamelService *service,
115 gboolean camel_service_disconnect (CamelService *service,
118 void camel_service_cancel_connect (CamelService *service);
119 gchar * camel_service_get_url (CamelService *service);
120 gchar * camel_service_get_name (CamelService *service,
122 gchar * camel_service_get_path (CamelService *service);
123 CamelSession * camel_service_get_session (CamelService *service);
124 CamelProvider * camel_service_get_provider (CamelService *service);
125 GList * camel_service_query_auth_types (CamelService *service,
128 /* Standard Camel function */
129 CamelType camel_service_get_type (void);
133 #endif /* CAMEL_SERVICE_H */