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.
30 #ifndef __MODEST_PRESETS_H__
31 #define __MODEST_PRESETS_H__
35 struct _ModestPresets {
36 /* private data: don't touch */
39 typedef struct _ModestPresets ModestPresets;
41 typedef enum _ModestPresetsInfo {
42 /* two bits for the server type */
43 MODEST_PRESETS_INFO_NONE = 0x0000,
44 MODEST_PRESETS_INFO_IMAP = 0x0001,
45 MODEST_PRESETS_INFO_POP = 0x0002,
46 MODEST_PRESETS_INFO_SMTP = 0x0003,
48 /* one bit for each of these */
49 MODEST_PRESETS_INFO_APOP = 0x0004,
50 MODEST_PRESETS_INFO_SECURE_SMTP = 0x0008,
51 MODEST_PRESETS_INFO_SECURE_INCOMING = 0x000f
54 /* typedef enum _ModestPresetsInfo ModestPresetsInfo; */
59 * @presetfile: the full path to the file with presets (in GKeyFile format)
61 * make a new ModestPresets instance
63 * Returns: a new ModestPresets instance, or NULL in case of error.
65 ModestPresets* modest_presets_new (const gchar *presetfile);
69 * modest_presets_get_providers:
70 * @self: a valid ModestPresets instance
71 * @mcc: limit the search to providers with this mcc (Mobile Country Code),
73 * @include_globals: include providers without MCC (such as GMail, Yahoo) if @mcc != 0?
75 * get a list of providers
77 * Returns: a newly allocated array of strings, or NULL in case of error
78 * should be freed with g_strvfree
81 gchar ** modest_presets_get_providers (ModestPresets *self, gint mcc,
82 gboolean include_globals);
85 * modest_presets_get_server:
86 * @self: a valid ModestPresets instance
87 * @provider: name of the provider
88 * @incoming_server: get the incoming mailserver if TRUE, get the
89 * outgoing server otherwise
91 * get the name of a incoming or outgoing mailserver
93 * Returns: a newly allocated string with the servername, or NULL in case
94 * of error, or server not found. (FIXME). Note that if the (incoming) server uses a
95 * non-standard port, the port number is appended to the name, eg. pop.foo.fi:995
97 gchar * modest_presets_get_server (ModestPresets *self,
98 const gchar *provider,
99 gboolean incoming_server);
101 * modest_presets_get_info:
102 * @self: a valid ModestPresets instance
103 * @provider: name of the provider
104 * @incoming_server: get the incoming mailserver if TRUE, get the
105 * outgoing server otherwise
107 * get information about some incoming or outgoing mailserver
109 * Returns: a ModestPresetsInfo with the required information
111 ModestPresetsInfo modest_presets_get_info (ModestPresets *self,
112 const gchar *provider,
113 gboolean incoming_server);
116 * modest_presets_destroy:
117 * @self: a valid ModestPresets instance (ie. must not be NULL)
119 * destroy ModestPresets instance; this is required after you're done with it.
121 void modest_presets_destroy (ModestPresets *self);
124 #endif /*__MODEST_PRESETS__*/