Fixes NB#110320, cannot remove messages from local folders
[modest] / src / hildon2 / modest-presets.h
1 /* Copyright (c) 2006, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
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.
16  *
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.
28  */
29
30 #ifndef __MODEST_PRESETS_H__
31 #define __MODEST_PRESETS_H__
32
33 #include <glib.h>
34 #include <modest-protocol.h>
35
36 struct _ModestPresets {
37 /* private data: don't touch */
38         GKeyFile *keyfile;
39 };
40 typedef struct _ModestPresets ModestPresets;
41
42
43 /**
44  * modest_presets_new:
45  * @presetfile: the full path to the file with presets (in GKeyFile format)
46  * 
47  * make a new ModestPresets instance
48  *
49  * Returns: a new ModestPresets instance, or NULL in case of error.
50  */
51 ModestPresets*            modest_presets_new             (const gchar *presetfile);
52
53
54 /**
55  * modest_presets_get_providers:
56  * @self: a valid ModestPresets instance
57  * @mcc: limit the search to providers with this mcc (Mobile Country Code),
58  *       or 0  to get all
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.
61  * 
62  * get a list of providers matching certian criteria
63  *
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
66  * 
67  **/
68 gchar **         modest_presets_get_providers   (ModestPresets *self, guint mcc, 
69                                                  gboolean include_globals, gchar ***provider_ids);
70
71 /**
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
77  *
78  * get the name of a incoming or outgoing mailserver
79  * 
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
83  */
84 gchar *                   modest_presets_get_server      (ModestPresets *self,
85                                                           const gchar *provider_id,
86                                                           gboolean incoming_server);
87                                                           
88 /**
89  * modest_presets_get_domain:
90  * @self: a valid ModestPresets instance
91  * @provider_id: ID of the provider 
92  *
93  * Get the name of the most-used domain for theis provider. For instance. hotmail.com
94  * 
95  * Returns: a newly allocated string with the domain name, or NULL in case
96  * of error.
97  */
98 gchar *                   modest_presets_get_domain      (ModestPresets *self,
99                                                           const gchar *provider_id);
100
101 /**
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
107  *
108  * get information about some incoming or outgoing mailserver
109  *
110  * Returns: a #ModestProtocolType with the required information
111  */
112 ModestProtocolType          modest_presets_get_info_server_type (ModestPresets *self,
113                                                                  const gchar *provider_id,
114                                                                  gboolean incoming_server);
115
116 /**
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
122  *
123  * get information about some incoming or outgoing mailserver
124  *
125  * Returns: #ModestProtocolType with server auth
126  */                                         
127 ModestProtocolType          modest_presets_get_info_server_auth (ModestPresets *self,
128                                                                  const gchar *provider_id,
129                                                                  gboolean incoming_server);
130
131 /**
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
137  *
138  * get information about some incoming or outgoing mailserver
139  *
140  * Returns: #ModestProtocolType with server security
141  */                                         
142 ModestProtocolType          modest_presets_get_info_server_security (ModestPresets *self,
143                                                                      const gchar *provider_id,
144                                                                      gboolean incoming_server);
145
146 /**
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
152  *
153  * get information about some incoming or outgoing mailserver
154  *
155  * Returns: %TRUE if we should use the alternate port.
156  */                                         
157 gboolean          modest_presets_get_info_server_use_alternate_port (ModestPresets *self,
158                                                                      const gchar *provider_id,
159                                                                      gboolean incoming_server);
160
161
162 /**
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
167  *
168  * Returns: the specific port number for some provider
169  * function return 0 if the normal port number is valid
170  *
171  */
172 guint modest_presets_get_port (ModestPresets *self, const gchar* provider_id,
173                                gboolean incoming_server);
174
175
176 /**
177  * modest_presets_destroy:
178  * @self: a valid ModestPresets instance (ie. must not be NULL)
179  *
180  * destroy ModestPresets instance; this is required after you're done with it.
181  */
182 void                      modest_presets_destroy         (ModestPresets *self);
183
184
185 #endif /*__MODEST_PRESETS__*/
186
187