* Fixed comments with errors
[modest] / src / 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
35 struct _ModestPresets {
36 /* private data: don't touch */
37         GKeyFile *keyfile;
38 };
39 typedef struct _ModestPresets ModestPresets;
40
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,
47
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   
52 } ModestPresetsInfo;
53
54 /* typedef enum _ModestPresetsInfo ModestPresetsInfo; */
55
56
57 /**
58  * modest_presets_new:
59  * @presetfile: the full path to the file with presets (in GKeyFile format)
60  * 
61  * make a new ModestPresets instance
62  *
63  * Returns: a new ModestPresets instance, or NULL in case of error.
64  */
65 ModestPresets*            modest_presets_new             (const gchar *presetfile);
66
67
68 /**
69  * modest_presets_get_providers:
70  * @self: a valid ModestPresets instance
71  * @mcc: limit the search to providers with this mcc (Mobile Country Code),
72  *       or <0 to get all
73  * @include_globals: include providers without MCC (such as GMail, Yahoo) if @mcc != 0?
74  * 
75  * get a list of providers
76  *
77  * Returns: a newly allocated array of strings, or NULL in case of error
78  * should be freed with g_strvfree
79  * 
80  **/
81 gchar **                  modest_presets_get_providers   (ModestPresets *self, gint mcc,
82                                                           gboolean include_globals);
83
84 /**
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
90  *
91  * get the name of a incoming or outgoing mailserver
92  * 
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
96  */
97 gchar *                   modest_presets_get_server      (ModestPresets *self,
98                                                           const gchar *provider,
99                                                           gboolean incoming_server);
100 /**
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
106  *
107  * get information about some incoming or outgoing mailserver
108  *
109  * Returns: a ModestPresetsInfo with the required information
110  */
111 ModestPresetsInfo          modest_presets_get_info (ModestPresets *self,
112                                                     const gchar *provider,
113                                                     gboolean incoming_server);
114
115 /**
116  * modest_presets_destroy:
117  * @self: a valid ModestPresets instance (ie. must not be NULL)
118  *
119  * destroy ModestPresets instance; this is required after you're done with it.
120  */
121 void                      modest_presets_destroy         (ModestPresets *self);
122
123
124 #endif /*__MODEST_PRESETS__*/
125
126