Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / libedataserver / e-account.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* 
3  * Copyright (C) 2003 Ximian, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU Lesser General Public
7  * License as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef __E_ACCOUNT__
21 #define __E_ACCOUNT__
22
23 #include <glib-object.h>
24
25 G_BEGIN_DECLS
26
27 #define E_TYPE_ACCOUNT            (e_account_get_type ())
28 #define E_ACCOUNT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ACCOUNT, EAccount))
29 #define E_ACCOUNT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ACCOUNT, EAccountClass))
30 #define E_IS_ACCOUNT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ACCOUNT))
31 #define E_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_ACCOUNT))
32
33 typedef enum _e_account_item_t {
34         E_ACCOUNT_NAME,
35
36         E_ACCOUNT_ID_NAME,
37         E_ACCOUNT_ID_ADDRESS,
38         E_ACCOUNT_ID_REPLY_TO,
39         E_ACCOUNT_ID_ORGANIZATION,
40         E_ACCOUNT_ID_SIGNATURE,
41
42         E_ACCOUNT_SOURCE_URL,   /* what about separating out host/user/path settings??  sigh */
43         E_ACCOUNT_SOURCE_KEEP_ON_SERVER,
44         E_ACCOUNT_SOURCE_AUTO_CHECK,
45         E_ACCOUNT_SOURCE_AUTO_CHECK_TIME,
46         E_ACCOUNT_SOURCE_SAVE_PASSWD,
47
48         E_ACCOUNT_TRANSPORT_URL,
49         E_ACCOUNT_TRANSPORT_SAVE_PASSWD,
50
51         E_ACCOUNT_DRAFTS_FOLDER_URI,
52         E_ACCOUNT_SENT_FOLDER_URI,
53
54         E_ACCOUNT_CC_ALWAYS,
55         E_ACCOUNT_CC_ADDRS,
56
57         E_ACCOUNT_BCC_ALWAYS,
58         E_ACCOUNT_BCC_ADDRS,
59
60         E_ACCOUNT_RECEIPT_POLICY,
61         
62         E_ACCOUNT_PGP_KEY,
63         E_ACCOUNT_PGP_ENCRYPT_TO_SELF,
64         E_ACCOUNT_PGP_ALWAYS_SIGN,
65         E_ACCOUNT_PGP_NO_IMIP_SIGN,
66         E_ACCOUNT_PGP_ALWAYS_TRUST,
67
68         E_ACCOUNT_SMIME_SIGN_KEY,
69         E_ACCOUNT_SMIME_ENCRYPT_KEY,
70         E_ACCOUNT_SMIME_SIGN_DEFAULT,
71         E_ACCOUNT_SMIME_ENCRYPT_TO_SELF,
72         E_ACCOUNT_SMIME_ENCRYPT_DEFAULT,
73
74         E_ACCOUNT_PROXY_PARENT_UID,
75
76         E_ACCOUNT_ITEM_LAST
77 } e_account_item_t;
78
79 typedef enum _e_account_access_t {
80         E_ACCOUNT_ACCESS_WRITE = 1<<0,
81 } e_account_access_t;
82
83 typedef struct _EAccountIdentity {
84         char *name;
85         char *address;
86         char *reply_to;
87         char *organization;
88         
89         char *sig_uid;
90 } EAccountIdentity;
91
92 typedef enum _EAccountReceiptPolicy {
93         E_ACCOUNT_RECEIPT_NEVER,
94         E_ACCOUNT_RECEIPT_ASK,
95         E_ACCOUNT_RECEIPT_ALWAYS
96 } EAccountReceiptPolicy;
97
98 typedef struct _EAccountService {
99         char *url;
100         gboolean keep_on_server;
101         gboolean auto_check;
102         int auto_check_time;
103         gboolean save_passwd;
104         gboolean get_password_canceled;
105 } EAccountService;
106
107 typedef struct _EAccount {
108         GObject parent_object;
109
110         char *name;
111         char *uid;
112
113         gboolean enabled;
114
115         EAccountIdentity *id;
116         EAccountService *source;
117         EAccountService *transport;
118
119         char *drafts_folder_uri, *sent_folder_uri;
120
121         gboolean always_cc;
122         char *cc_addrs;
123         gboolean always_bcc;
124         char *bcc_addrs;
125
126         EAccountReceiptPolicy receipt_policy;
127
128         char *pgp_key;
129         gboolean pgp_encrypt_to_self;
130         gboolean pgp_always_sign;
131         gboolean pgp_no_imip_sign;
132         gboolean pgp_always_trust;
133
134         char *parent_uid;
135
136         char *smime_sign_key;
137         char *smime_encrypt_key;
138         gboolean smime_sign_default;
139         gboolean smime_encrypt_to_self;
140         gboolean smime_encrypt_default;
141 } EAccount;
142
143 typedef struct {
144         GObjectClass parent_class;
145
146         void (*changed)(EAccount *, int field);
147 } EAccountClass;
148
149
150 GType     e_account_get_type (void);
151
152 EAccount *e_account_new          (void);
153
154 EAccount *e_account_new_from_xml (const char *xml);
155
156 gboolean  e_account_set_from_xml (EAccount   *account,
157                                   const char *xml);
158
159 void      e_account_import       (EAccount   *dest,
160                                   EAccount   *src);
161
162 char     *e_account_to_xml       (EAccount   *account);
163
164
165 char     *e_account_uid_from_xml (const char *xml);
166
167 const char *e_account_get_string (EAccount *,
168                                   e_account_item_t type);
169
170 int       e_account_get_int      (EAccount *,
171                                   e_account_item_t type);
172
173 gboolean  e_account_get_bool     (EAccount *,
174                                   e_account_item_t type);
175
176 void      e_account_set_string   (EAccount *,
177                                   e_account_item_t type, const char *);
178
179 void      e_account_set_int      (EAccount *,
180                                   e_account_item_t type, int);
181
182 void      e_account_set_bool     (EAccount *,
183                                   e_account_item_t type, gboolean);
184
185 gboolean  e_account_writable     (EAccount *ea,
186                                   e_account_item_t type);
187
188 gboolean  e_account_writable_option (EAccount *ea,
189                                   const char *protocol,
190                                   const char *option);
191
192 G_END_DECLS
193
194 #endif /* __E_ACCOUNT__ */