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__
34 #include <modest-protocol.h>
36 struct _ModestPresets {
37 /* private data: don't touch */
40 typedef struct _ModestPresets ModestPresets;
45 * @presetfile: the full path to the file with presets (in GKeyFile format)
47 * make a new ModestPresets instance
49 * Returns: a new ModestPresets instance, or NULL in case of error.
51 ModestPresets* modest_presets_new (const gchar *presetfile);
55 * modest_presets_get_providers:
56 * @self: a valid ModestPresets instance
57 * @mcc: limit the search to providers with this mcc (Mobile Country Code),
59 * @include_globals: include (global) providers without MCC (such as GMail, Yahoo)
60 * @provider_ids: Output parameter, which will be set to a newly allocated array of strings, or NULL in case of error.
62 * get a list of providers matching certian criteria
64 * Returns: The provider names, as a newly allocated array of strings, or NULL in case of error
65 * should be freed with g_strfreev
68 gchar ** modest_presets_get_providers (ModestPresets *self, guint mcc,
69 gboolean include_globals, gchar ***provider_ids);
72 * modest_presets_get_server:
73 * @self: a valid ModestPresets instance
74 * @provider_id: ID of the provider
75 * @incoming_server: get the incoming mailserver if TRUE, get the
76 * outgoing server otherwise
78 * get the name of a incoming or outgoing mailserver
80 * Returns: a newly allocated string with the servername, or NULL in case
81 * of error, or server not found. (FIXME). Note that if the (incoming) server uses a
82 * non-standard port, the port number is appended to the name, eg. pop.foo.fi:995
84 gchar * modest_presets_get_server (ModestPresets *self,
85 const gchar *provider_id,
86 gboolean incoming_server);
89 * modest_presets_get_domain:
90 * @self: a valid ModestPresets instance
91 * @provider_id: ID of the provider
93 * Get the name of the most-used domain for theis provider. For instance. hotmail.com
95 * Returns: a newly allocated string with the domain name, or NULL in case
98 gchar * modest_presets_get_domain (ModestPresets *self,
99 const gchar *provider_id);
102 * modest_presets_get_info_server_type:
103 * @self: a valid ModestPresets instance
104 * @provider_id: ID of the provider
105 * @incoming_server: get the incoming mailserver if TRUE, get the
106 * outgoing server otherwise
108 * get information about some incoming or outgoing mailserver
110 * Returns: a #ModestProtocolType with the required information
112 ModestProtocolType modest_presets_get_info_server_type (ModestPresets *self,
113 const gchar *provider_id,
114 gboolean incoming_server);
117 * modest_presets_get_info_server_security:
118 * @self: a valid ModestPresets instance
119 * @provider_id: ID of the provider
120 * @incoming_server: get the incoming mailserver if TRUE, get the
121 * outgoing server otherwise
123 * get information about some incoming or outgoing mailserver
125 * Returns: #ModestProtocolType with server auth
127 ModestProtocolType modest_presets_get_info_server_auth (ModestPresets *self,
128 const gchar *provider_id,
129 gboolean incoming_server);
132 * modest_presets_get_info_server_security:
133 * @self: a valid ModestPresets instance
134 * @provider_id: ID of the provider
135 * @incoming_server: get the incoming mailserver if TRUE, get the
136 * outgoing server otherwise
138 * get information about some incoming or outgoing mailserver
140 * Returns: #ModestProtocolType with server security
142 ModestProtocolType modest_presets_get_info_server_security (ModestPresets *self,
143 const gchar *provider_id,
144 gboolean incoming_server);
147 * modest_presets_get_info_server_security:
148 * @self: a valid ModestPresets instance
149 * @provider_id: ID of the provider
150 * @incoming_server: get the incoming mailserver if TRUE, get the
151 * outgoing server otherwise
153 * get information about some incoming or outgoing mailserver
155 * Returns: %TRUE if we should use the alternate port.
157 gboolean modest_presets_get_info_server_use_alternate_port (ModestPresets *self,
158 const gchar *provider_id,
159 gboolean incoming_server);
163 * modest_presets_get_port:
164 * @self: a valid ModestPresets instance
165 * @provider_id: ID of the provider
166 * @incoming_server: get port# for the incoming mailserver if TRUE, for the outgoing server otherwise
168 * Returns: the specific port number for some provider
169 * function return 0 if the normal port number is valid
172 guint modest_presets_get_port (ModestPresets *self, const gchar* provider_id,
173 gboolean incoming_server);
177 * modest_presets_destroy:
178 * @self: a valid ModestPresets instance (ie. must not be NULL)
180 * destroy ModestPresets instance; this is required after you're done with it.
182 void modest_presets_destroy (ModestPresets *self);
185 #endif /*__MODEST_PRESETS__*/