~ubuntu-branches/ubuntu/karmic/libtinymail/karmic

« back to all changes in this revision

Viewing changes to libtinymail-camel/camel-lite/camel/camel-service.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-10-12 11:21:12 UTC
  • Revision ID: james.westby@ubuntu.com-20071012112112-fod9fs7yrooxjr7i
Tags: upstream-0.0.2
ImportĀ upstreamĀ versionĀ 0.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
2
/* camel-service.h : Abstract class for an email service */
 
3
/* 
 
4
 *
 
5
 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
 
6
 *          Michael Zucchi <notzed@ximian.com>
 
7
 *
 
8
 * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
 
9
 *
 
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.
 
13
 *
 
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.
 
18
 *
 
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
22
 * USA
 
23
 */
 
24
 
 
25
#ifndef CAMEL_SERVICE_H
 
26
#define CAMEL_SERVICE_H 1
 
27
 
 
28
#include <camel/camel-object.h>
 
29
#include <camel/camel-url.h>
 
30
#include <camel/camel-provider.h>
 
31
#include <camel/camel-operation.h>
 
32
 
 
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))
 
37
 
 
38
G_BEGIN_DECLS
 
39
 
 
40
enum {
 
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,
 
47
};
 
48
 
 
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)
 
54
 
 
55
typedef enum {
 
56
        CAMEL_SERVICE_DISCONNECTED,
 
57
        CAMEL_SERVICE_CONNECTING,
 
58
        CAMEL_SERVICE_CONNECTED,
 
59
        CAMEL_SERVICE_DISCONNECTING
 
60
} CamelServiceConnectionStatus;
 
61
 
 
62
typedef void (*con_op) (CamelService *service, gboolean suc, gpointer data);
 
63
 
 
64
struct _CamelService {
 
65
        CamelObject parent_object;
 
66
        struct _CamelServicePrivate *priv;
 
67
 
 
68
        CamelSession *session;
 
69
        CamelProvider *provider;
 
70
        CamelServiceConnectionStatus status;
 
71
        CamelOperation *connect_op;
 
72
        CamelURL *url;
 
73
        gpointer data;
 
74
        gboolean reconnecting;
 
75
 
 
76
        con_op connecting;
 
77
        con_op disconnecting;
 
78
        con_op reconnecter;
 
79
        con_op reconnection;
 
80
};
 
81
 
 
82
typedef struct {
 
83
        CamelObjectClass parent_class;
 
84
 
 
85
        void      (*construct)         (CamelService *service,
 
86
                                        CamelSession *session,
 
87
                                        CamelProvider *provider,
 
88
                                        CamelURL *url,
 
89
                                        CamelException *ex);
 
90
 
 
91
        gboolean  (*connect)           (CamelService *service, 
 
92
                                        CamelException *ex);
 
93
        gboolean  (*disconnect)        (CamelService *service,
 
94
                                        gboolean clean,
 
95
                                        CamelException *ex);
 
96
        void      (*cancel_connect)    (CamelService *service);
 
97
 
 
98
        GList *   (*query_auth_types)  (CamelService *service,
 
99
                                        CamelException *ex);
 
100
 
 
101
        char *    (*get_name)          (CamelService *service,
 
102
                                        gboolean brief);
 
103
        char *    (*get_path)          (CamelService *service);
 
104
 
 
105
} CamelServiceClass;
 
106
 
 
107
/* query_auth_types returns a GList of these */
 
108
typedef struct {
 
109
        char *name;               /* user-friendly name */
 
110
        char *description;
 
111
        char *authproto;
 
112
        
 
113
        gboolean need_password;   /* needs a password to authenticate */
 
114
} CamelServiceAuthType;
 
115
 
 
116
/* public methods */
 
117
void                camel_service_construct          (CamelService *service,
 
118
                                                      CamelSession *session,
 
119
                                                      CamelProvider *provider,
 
120
                                                      CamelURL *url, 
 
121
                                                      CamelException *ex);
 
122
gboolean            camel_service_connect            (CamelService *service, 
 
123
                                                      CamelException *ex);
 
124
gboolean            camel_service_disconnect         (CamelService *service,
 
125
                                                      gboolean clean,
 
126
                                                      CamelException *ex);
 
127
void                camel_service_cancel_connect     (CamelService *service);
 
128
char *              camel_service_get_url            (CamelService *service);
 
129
char *              camel_service_get_name           (CamelService *service,
 
130
                                                      gboolean brief);
 
131
char *              camel_service_get_path           (CamelService *service);
 
132
CamelSession *      camel_service_get_session        (CamelService *service);
 
133
CamelProvider *     camel_service_get_provider       (CamelService *service);
 
134
GList *             camel_service_query_auth_types   (CamelService *service,
 
135
                                                      CamelException *ex);
 
136
 
 
137
/* Standard Camel function */
 
138
CamelType camel_service_get_type (void);
 
139
 
 
140
G_END_DECLS
 
141
 
 
142
#endif /* CAMEL_SERVICE_H */