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, /* if set, port will be 465
55 MODEST_PRESETS_SECURITY_SECURE_INCOMING = 1 << 2,
56 MODEST_PRESETS_SECURITY_SECURE_INCOMING_ALTERNATE_PORT = 1 << 3, /* POP3S=>995, IMAPS=>993 */
57 } ModestPresetsSecurity;
59 /* typedef enum _ModestPresetsInfo ModestPresetsInfo; */
64 * @presetfile: the full path to the file with presets (in GKeyFile format)
66 * make a new ModestPresets instance
68 * Returns: a new ModestPresets instance, or NULL in case of error.
70 ModestPresets* modest_presets_new (const gchar *presetfile);
74 * modest_presets_get_providers:
75 * @self: a valid ModestPresets instance
76 * @mcc: limit the search to providers with this mcc (Mobile Country Code),
78 * @include_globals: include (global) providers without MCC (such as GMail, Yahoo)
79 * @provider_ids: Output parameter, which will be set to a newly allocated array of strings, or NULL in case of error.
81 * get a list of providers matching certian criteria
83 * Returns: The provider names, as a newly allocated array of strings, or NULL in case of error
84 * should be freed with g_strfreev
87 gchar ** modest_presets_get_providers (ModestPresets *self, guint mcc,
88 gboolean include_globals, gchar ***provider_ids);
91 * modest_presets_get_server:
92 * @self: a valid ModestPresets instance
93 * @provider_id: ID of the provider
94 * @incoming_server: get the incoming mailserver if TRUE, get the
95 * outgoing server otherwise
97 * get the name of a incoming or outgoing mailserver
99 * Returns: a newly allocated string with the servername, or NULL in case
100 * of error, or server not found. (FIXME). Note that if the (incoming) server uses a
101 * non-standard port, the port number is appended to the name, eg. pop.foo.fi:995
103 gchar * modest_presets_get_server (ModestPresets *self,
104 const gchar *provider_id,
105 gboolean incoming_server);
108 * modest_presets_get_domain:
109 * @self: a valid ModestPresets instance
110 * @provider_id: ID of the provider
112 * Get the name of the most-used domain for theis provider. For instance. hotmail.com
114 * Returns: a newly allocated string with the domain name, or NULL in case
117 gchar * modest_presets_get_domain (ModestPresets *self,
118 const gchar *provider_id);
121 * modest_presets_get_info_server_type:
122 * @self: a valid ModestPresets instance
123 * @provider_id: ID of the provider
124 * @incoming_server: get the incoming mailserver if TRUE, get the
125 * outgoing server otherwise
127 * get information about some incoming or outgoing mailserver
129 * Returns: a ModestPresetsServerType with the required information
131 ModestPresetsServerType modest_presets_get_info_server_type (ModestPresets *self,
132 const gchar *provider_id,
133 gboolean incoming_server);
136 * modest_presets_get_info_server_security:
137 * @self: a valid ModestPresets instance
138 * @provider_id: ID of the provider
139 * @incoming_server: get the incoming mailserver if TRUE, get the
140 * outgoing server otherwise
142 * get information about some incoming or outgoing mailserver
144 * Returns: ModestPresetsSecurity ORable flags with the required information
146 ModestPresetsSecurity modest_presets_get_info_server_security (ModestPresets *self,
147 const gchar *provider_id,
148 gboolean incoming_server);
151 * modest_presets_destroy:
152 * @self: a valid ModestPresets instance (ie. must not be NULL)
154 * destroy ModestPresets instance; this is required after you're done with it.
156 void modest_presets_destroy (ModestPresets *self);
159 #endif /*__MODEST_PRESETS__*/