1 /* Copyright (c) 2006, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 /* modest-identity-mgr.h */
33 #ifndef __MODEST_IDENTITY_MGR_H__
34 #define __MODEST_IDENTITY_MGR_H__
36 #include <glib-object.h>
37 #include "modest-conf.h"
38 #include "modest-identity-keys.h"
39 #include "modest-proto.h"
42 /* convenience macros */
43 #define MODEST_TYPE_IDENTITY_MGR (modest_identity_mgr_get_type())
44 #define MODEST_IDENTITY_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_IDENTITY_MGR,ModestIdentityMgr))
45 #define MODEST_IDENTITY_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_IDENTITY_MGR,GObject))
46 #define MODEST_IS_IDENTITY_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_IDENTITY_MGR))
47 #define MODEST_IS_IDENTITY_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_IDENTITY_MGR))
48 #define MODEST_IDENTITY_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_IDENTITY_MGR,ModestIdentityMgrClass))
49 typedef struct _ModestIdentityMgr ModestIdentityMgr;
50 typedef struct _ModestIdentityMgrClass ModestIdentityMgrClass;
53 struct _ModestIdentityMgr {
55 /* insert public members, if any */
58 struct _ModestIdentityMgrClass {
59 GObjectClass parent_class;
60 /* insert signal callback declarations, eg. */
61 /* void (* my_event) (ModestIdentityMgr* obj); */
68 * get the GType for ModestIdentityMgr
72 GType modest_identity_mgr_get_type (void) G_GNUC_CONST;
76 * modest_identity_mgr_new:
77 * @modest_conf: a ModestConf instance
79 * Returns: a new ModestIdentityMgr, or NULL in case of error
81 GObject * modest_identity_mgr_new (ModestConf * modest_conf);
85 * modest_identity_mgr_add_identity:
86 * @self: a ModestIdentityMgr instance
87 * @name: the name (id) for the identity
88 * @realname: the real name of the user
89 * @email: the user's email address which is used when sending email
90 * @replyto: the default replyto address
91 * @signature: the signature for this identity
92 * @use_signature: whether to use this signature instead of the default one
93 * @id_via: the transport to send emails for this identity via
94 * @use_id_via: whether to use this via instead of the default one
96 * add a user identity to the configuration
98 * Returns: TRUE if succeeded, FALSE otherwise,
100 gboolean modest_identity_mgr_add_identity (ModestIdentityMgr * self,
102 const gchar * realname,
104 const gchar * replyto,
105 const gchar * signature,
106 const gboolean use_signature,
107 const gchar * id_via,
108 const gboolean use_id_via);
112 * modest_identity_mgr_remove_identity:
113 * @self: a ModestIdentityMgr instance
114 * @name: the name of the identity to remove
115 * @err: a GError ptr, or NULL to ignore.
117 * remove identity from the configuration
118 * the identity with @name should exist
120 * Returns: TRUE if the removal succeeded, FALSE otherwise,
121 * @err gives details in case of error
123 gboolean modest_identity_mgr_remove_identity (ModestIdentityMgr * self,
129 * modest_identity_mgr_identity_names:
130 * @self: a ModestIdentityMgr instance
131 * @err: a GError ptr, or NULL to ignore.
133 * list all identities
135 * Returns: a newly allocated list of identities, or NULL in case of error or
136 * if there are no identities. The caller must free the returned GSList
137 * @err gives details in case of error
139 GSList *modest_identity_mgr_identity_names (ModestIdentityMgr * self,
144 * modest_identity_mgr_identity_exists:
145 * @self: a ModestIdentityMgr instance
146 * @err: a GError ptr, or NULL to ignore.
148 * check whether identity @name exists
150 * Returns: TRUE if the identity exists, FALSE otherwise (or in case of error)
151 * @err gives details in case of error
153 gboolean modest_identity_mgr_identity_exists (ModestIdentityMgr * self,
158 /* identity specific functions */
161 * modest_identity_mgr_get_identity_string:
162 * @self: a ModestIdentityMgr instance
163 * @name: the name of the identity
164 * @key: the key of the value to retrieve
165 * @err: a GError ptr, or NULL to ignore.
167 * get a config string from an identity
169 * Returns: a newly allocated string with the value for the key,
170 * or NULL in case of error. @err gives details in case of error
172 gchar *modest_identity_mgr_get_identity_string (ModestIdentityMgr * self,
179 * modest_identity_mgr_get_identity_int:
180 * @self: a ModestIdentityMgr instance
181 * @name: the name of the identity
182 * @key: the key of the value to retrieve
183 * @err: a GError ptr, or NULL to ignore.
185 * get a config int from an identity
187 * Returns: an integer with the value for the key, or -1 in case of
188 * error (but of course -1 does not necessarily imply an error)
189 * @err gives details in case of error
191 gint modest_identity_mgr_get_identity_int (ModestIdentityMgr * self,
198 * modest_identity_mgr_get_identity_bool:
199 * @self: a ModestIdentityMgr instance
200 * @name: the name of the identity
201 * @key: the key of the value to retrieve
202 * @err: a GError ptr, or NULL to ignore.
204 * get a config boolean from an identity
206 * Returns: an boolean with the value for the key, or FALSE in case of
207 * error (but of course FALSE does not necessarily imply an error)
208 * @err gives details in case of error
210 gboolean modest_identity_mgr_get_identity_bool (ModestIdentityMgr * self,
217 * modest_identity_mgr_set_identity_string:
218 * @self: a ModestIdentityMgr instance
219 * @name: the name of the identity
220 * @key: the key of the value to set
221 * @val: the value to set
222 * @err: a GError ptr, or NULL to ignore.
224 * set a config string for an identity
226 * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
227 * @err gives details in case of error
229 gboolean modest_identity_mgr_set_identity_string (ModestIdentityMgr *
238 * modest_identity_mgr_set_identity_int:
239 * @self: a ModestIdentityMgr instance
240 * @name: the name of the identity
241 * @key: the key of the value to set
242 * @val: the value to set
243 * @err: a GError ptr, or NULL to ignore.
245 * set a config int for an identity
247 * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
248 * @err gives details in case of error
250 gboolean modest_identity_mgr_set_identity_int (ModestIdentityMgr * self,
253 gint val, GError ** err);
257 * modest_identity_mgr_set_identity_bool:
258 * @self: a ModestIdentityMgr instance
259 * @name: the name of the identity
260 * @key: the key of the value to set
261 * @val: the value to set
262 * @err: a GError ptr, or NULL to ignore.
264 * set a config bool for an identity
266 * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
267 * @err gives details in case of error
269 gboolean modest_identity_mgr_set_identity_bool (ModestIdentityMgr * self,
277 #endif /* __MODEST_IDENTITY_MGR_H__ */