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 _ModestPresetsServerType {
42 MODEST_PRESETS_SERVER_TYPE_NONE,
43 MODEST_PRESETS_SERVER_TYPE_IMAP,
44 MODEST_PRESETS_SERVER_TYPE_POP,
45 MODEST_PRESETS_SERVER_TYPE_SMTP
46 } ModestPresetsServerType;
48 /** These are flags, which should be ORed.
50 typedef enum _ModestPresetsSecurity {
51 MODEST_PRESETS_SECURITY_NONE = 0,
52 MODEST_PRESETS_SECURITY_APOP = 1 << 0,
53 MODEST_PRESETS_SECURITY_SECURE_SMTP = 1 << 1,
54 MODEST_PRESETS_SECURITY_SECURE_INCOMING = 1 << 2
55 } ModestPresetsSecurity;
57 /* typedef enum _ModestPresetsInfo ModestPresetsInfo; */
62 * @presetfile: the full path to the file with presets (in GKeyFile format)
64 * make a new ModestPresets instance
66 * Returns: a new ModestPresets instance, or NULL in case of error.
68 ModestPresets* modest_presets_new (const gchar *presetfile);
72 * modest_presets_get_providers:
73 * @self: a valid ModestPresets instance
74 * @mcc: limit the search to providers with this mcc (Mobile Country Code),
76 * @include_globals: include (global) providers without MCC (such as GMail, Yahoo)
77 * @provider_ids: Output parameter, which will be set to a newly allocated array of strings, or NULL in case of error.
79 * get a list of providers matching certian criteria
81 * Returns: The provider names, as a newly allocated array of strings, or NULL in case of error
82 * should be freed with g_strfreev
85 gchar ** modest_presets_get_providers (ModestPresets *self, guint mcc,
86 gboolean include_globals, gchar ***provider_ids);
89 * modest_presets_get_server:
90 * @self: a valid ModestPresets instance
91 * @provider_id: ID of the provider
92 * @incoming_server: get the incoming mailserver if TRUE, get the
93 * outgoing server otherwise
95 * get the name of a incoming or outgoing mailserver
97 * Returns: a newly allocated string with the servername, or NULL in case
98 * of error, or server not found. (FIXME). Note that if the (incoming) server uses a
99 * non-standard port, the port number is appended to the name, eg. pop.foo.fi:995
101 gchar * modest_presets_get_server (ModestPresets *self,
102 const gchar *provider_id,
103 gboolean incoming_server);
106 * modest_presets_get_domain:
107 * @self: a valid ModestPresets instance
108 * @provider_id: ID of the provider
110 * Get the name of the most-used domain for theis provider. For instance. hotmail.com
112 * Returns: a newly allocated string with the domain name, or NULL in case
115 gchar * modest_presets_get_domain (ModestPresets *self,
116 const gchar *provider_id);
119 * modest_presets_get_info_server_type:
120 * @self: a valid ModestPresets instance
121 * @provider_id: ID of the provider
122 * @incoming_server: get the incoming mailserver if TRUE, get the
123 * outgoing server otherwise
125 * get information about some incoming or outgoing mailserver
127 * Returns: a ModestPresetsServerType with the required information
129 ModestPresetsServerType modest_presets_get_info_server_type (ModestPresets *self,
130 const gchar *provider_id,
131 gboolean incoming_server);
134 * modest_presets_get_info_server_security:
135 * @self: a valid ModestPresets instance
136 * @provider_id: ID of the provider
137 * @incoming_server: get the incoming mailserver if TRUE, get the
138 * outgoing server otherwise
140 * get information about some incoming or outgoing mailserver
142 * Returns: ModestPresetsSecurity ORable flags with the required information
144 ModestPresetsSecurity modest_presets_get_info_server_security (ModestPresets *self,
145 const gchar *provider_id,
146 gboolean incoming_server);
149 * modest_presets_destroy:
150 * @self: a valid ModestPresets instance (ie. must not be NULL)
152 * destroy ModestPresets instance; this is required after you're done with it.
154 void modest_presets_destroy (ModestPresets *self);
157 #endif /*__MODEST_PRESETS__*/