* src/maemo/modest-main-window.c:
[modest] / src / modest-protocol-info.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_PROTOCOL_INFO_H__
31 #define __MODEST_PROTOCOL_INFO_H__
32
33 #include <modest-pair.h>
34 #include <glib.h>
35
36 G_BEGIN_DECLS
37
38 /** Transport and Store protocols. */
39 typedef enum {
40         MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN,
41         MODEST_PROTOCOL_TRANSPORT_SENDMAIL,
42         MODEST_PROTOCOL_TRANSPORT_SMTP,
43
44         MODEST_PROTOCOL_STORE_POP,
45         MODEST_PROTOCOL_STORE_IMAP,
46         MODEST_PROTOCOL_STORE_MAILDIR,
47         MODEST_PROTOCOL_STORE_MBOX
48 } ModestTransportStoreProtocol;
49
50 /** Secure connection methods. */
51 typedef enum {    
52         MODEST_PROTOCOL_CONNECTION_NORMAL,
53         MODEST_PROTOCOL_CONNECTION_SSL,   
54         MODEST_PROTOCOL_CONNECTION_TLS,
55         MODEST_PROTOCOL_CONNECTION_TLS_OP
56 } ModestConnectionProtocol;
57
58 /** Secure authentication methods. */
59 typedef enum {    
60         MODEST_PROTOCOL_AUTH_NONE,
61         MODEST_PROTOCOL_AUTH_PASSWORD,
62         MODEST_PROTOCOL_AUTH_CRAMMD5
63 } ModestAuthProtocol;
64
65
66
67
68 /**
69  * modest_protocol_info_get_transport_store_protocol_pair_list:
70  * 
71  * return the list of <protocol,display-name>-tupels of protocols.
72  * The elements of the returned list are ModestPairs
73  * This is a convenience function for use with ModestComboBox
74  *  
75  * Returns: a list of protocols. After use, it should be freed
76  * with modest_pair_list_free
77  */
78 ModestPairList*
79 modest_protocol_info_get_transport_store_protocol_pair_list ();
80
81 /**
82  * modest_protocol_info_get_supported_store_protocol_pair_list:
83  * 
84  * return the list of <protocol,display-name>-tuples of 
85  * store protocols.
86  * The elements of the returned list are ModestPairs
87  * This is a convenience function for use with ModestComboBox
88  *
89  * In this case it only returns the UI exposed protocols for
90  * storage (IMAP, POP3).
91  *  
92  * Returns: a list of protocols. After use, it should be freed
93  * with modest_pair_list_free
94  */
95 ModestPairList*
96 modest_protocol_info_get_supported_store_protocol_pair_list ();
97
98 /**
99  * modest_protocol_info_get_auth_protocol_pair_list:
100  * 
101  * return the list of <protocol,display-name>-tupels of protocols.
102  * The elements of the returned list are ModestPairs
103  * This is a convenience function for use with ModestComboBox
104  *  
105  * Returns: a list of protocols. After use, it should be freed
106  * with modest_pair_list_free
107  */
108 ModestPairList* modest_protocol_info_get_auth_protocol_pair_list (void);
109
110
111 /**
112  * modest_protocol_info_get_connection_protocol_pair_list:
113  * 
114  * return the list of <protocol,display-name>-tupels of protocols.
115  * The elements of the returned list are ModestPairs
116  * This is a convenience function for use with ModestComboBox
117  *  
118  * Returns: a list of protocols. After use, it should be freed
119  * with modest_pair_list_free
120  */
121 ModestPairList* modest_protocol_info_get_connection_protocol_pair_list (void);
122         
123         
124 /**
125  * modest_protocol_info_get_transport_store_protocol:
126  * @name: the name of the  #ModestTransportStoreProtocol
127  *
128  * return the id of the protocol with the given name
129  *  
130  * Returns: the id of the protocol or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN
131  */
132 ModestTransportStoreProtocol modest_protocol_info_get_transport_store_protocol (const gchar* name);
133
134 /**
135  * modest_protocol_info_get_auth_protocol:
136  * @name: The name of the #ModestAuthProtocol
137  *
138  * Returns the ID of the protocol with the given name
139  *
140  * Returns: The ID of the protocol or MODEST_PROTOCOL_AUTH_NONE
141  */
142 ModestAuthProtocol modest_protocol_info_get_auth_protocol (const gchar* name);
143
144 /**
145  * modest_protocol_info_get_connection_protocol:
146  * @name: The name of the #ModestConnectionProtocol
147  *
148  * Returns the ID of the protocol with the given name
149  *
150  * Returns: The ID of the protocol or MODEST_CONNECTION_PROTOCOL_NORMAL
151  */
152 ModestConnectionProtocol modest_protocol_info_get_connection_protocol (const gchar* name);
153
154 /**
155  * modest_protocol_info_get_transport_store_protocol_name:
156  * @proto: the protocol you are looking for
157  * 
158  * return the string id of the proto (such as "imap", or "smtp")
159  *  
160  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
161  */
162 const gchar* modest_protocol_info_get_transport_store_protocol_name (ModestTransportStoreProtocol proto);
163
164 /**
165  * modest_protocol_info_get_auth_protocol_name:
166  * @proto: the protocol you are looking for
167  * 
168  * return the string id of the proto (such as "password", or "cram-md5")
169  *  
170  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
171  */
172 const gchar* modest_protocol_info_get_auth_protocol_name (ModestAuthProtocol proto);
173
174 /*
175  * modest_protocol_get_auth_protocol_pair_list:
176  *
177  * Get the list of support authentication methods supported by modest including 
178  * the display names of those.
179  *
180  * Returns: List of method/display name pairs
181  */
182 ModestPairList* modest_protocol_info_get_auth_protocol_pair_list (void);
183
184 /**
185  * modest_protocol_info_get_auth_protocol_name:
186  * @proto: the protocol you are looking for
187  * 
188  * return the string id of the proto (such as "ssl", or "tls")
189  *   
190  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
191  */
192 const gchar*
193 modest_protocol_info_get_connection_protocol_name (ModestAuthProtocol proto);
194
195
196 /**
197  * modest_protocol_info_protocol_is_local_store:
198  * @proto: the protocol
199  *
200  * is this protocol a store protocol?
201  *  
202  * Returns: TRUE if it is a local store, FALSE otherwise
203  *
204  */
205 gboolean modest_protocol_info_protocol_is_store (ModestTransportStoreProtocol proto);
206
207
208 /**
209  * modest_protocol_info_protocol_is_local_store:
210  * @proto: the protocol
211  *
212  * is this protocol a local store protocol?
213  *  
214  * Returns: TRUE if it is a local store, FALSE otherwise
215  *
216  */
217 gboolean modest_protocol_info_protocol_is_local_store (ModestTransportStoreProtocol proto);
218
219
220 /**
221  * modest_protocol_info_is_secure:
222  * @protocol
223  * 
224  * is the protocol connection secure (e.g encrypted)?
225  * 
226  * Returns: TRUE if it is secure, FALSE otherwise
227  *
228  */
229 gboolean modest_protocol_info_is_secure(ModestConnectionProtocol protocol);
230
231 /**
232  * modest_protocol_info_auth_is_secure:
233  * @protocol
234  * 
235  * is the protocol authentication secure (e.g encrypted)?
236  * 
237  * Returns: TRUE if it is secure, FALSE otherwise
238  *
239  */
240 gboolean modest_protocol_info_auth_is_secure(ModestAuthProtocol protocol);
241
242
243 G_END_DECLS
244 #endif /* __MODEST_PROTOCOL_INFO_H__ */
245