2007-05-14 Murray Cumming <murrayc@murrayc.com>
[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
35 G_BEGIN_DECLS
36
37 /* NOTE: be careful to check modest-protocol-info.c
38  * if you make any changes here */
39 typedef enum {
40         MODEST_PROTOCOL_UNKNOWN,
41         
42         MODEST_PROTOCOL_TRANSPORT_SENDMAIL,
43         MODEST_PROTOCOL_TRANSPORT_SMTP,
44         
45         MODEST_PROTOCOL_STORE_POP,
46         MODEST_PROTOCOL_STORE_IMAP,
47         MODEST_PROTOCOL_STORE_MAILDIR,
48         MODEST_PROTOCOL_STORE_MBOX
49 } ModestProtocol;
50
51
52 typedef enum {
53         MODEST_PROTOCOL_TYPE_UNKNOWN,
54         MODEST_PROTOCOL_TYPE_TRANSPORT,
55         MODEST_PROTOCOL_TYPE_STORE
56 } ModestProtocolType;
57
58 typedef enum {    
59         MODEST_PROTOCOL_SECURITY_NONE,
60         MODEST_PROTOCOL_SECURITY_SSL,   
61         MODEST_PROTOCOL_SECURITY_TLS,
62         MODEST_PROTOCOL_SECURITY_TLS_OP
63 } ModestSecureConnection;
64
65 typedef enum {    
66         MODEST_PROTOCOL_AUTH_NONE,
67         MODEST_PROTOCOL_AUTH_PASSWORD,
68         MODEST_PROTOCOL_AUTH_CRAMMD5
69 } ModestSecureAuthentication;
70
71
72 #if 0 
73 /**
74  * modest_protocol_info_get_list:
75  * @type: the type of list you want, it should NOT be MODEST_PROTOCOL_TYPE_UNKNOWN
76  *
77  * return the list of protocols of the given @type.
78  * the elements of the returned list are ModestProtocols (use GPOINTER_TO_INT to get it)
79  *  
80  * Returns: a list of protocols of the given @type; after use, it should be freed
81  * with g_slist_free. The elements should not be freed, as there is no memory allocated
82  * for them.
83  */
84 GSList*   modest_protocol_info_get_protocol_list (ModestProtocolType type);
85 #endif
86
87
88 /**
89  * modest_protocol_info_get_protocol_pair_list:
90  *
91  * return the list of <protocol,display-name>-tupels of protocols.
92  * The elements of the returned list are ModestPairs
93  * This is a convenience function for use with ModestComboBox
94  *  
95  * Returns: a list of protocols. After use, it should be freed
96  * with modest_pair_list_free
97  */
98 ModestPairList*   modest_protocol_info_get_protocol_pair_list ();
99
100 /**
101  * modest_protocol_info_get_protocol_security_pair_list:
102  *
103  * return the list of <protocol,display-name>-tupels of protocol secure connection methods.
104  * The elements of the returned list are ModestPairs
105  * This is a convenience function for use with ModestComboBox
106  *  
107  * Returns: a list of secure connection methods. After use, it should be freed
108  * with modest_pair_list_free
109  */
110 ModestPairList*   modest_protocol_info_get_protocol_security_pair_list ();
111
112 /**
113  * modest_protocol_info_get_protocol_auth_pair_list:
114  *
115  * return the list of <protocol,display-name>-tupels of protocol secure authentication methods.
116  * The elements of the returned list are ModestPairs
117  * This is a convenience function for use with ModestComboBox
118  *  
119  * Returns: a list of secure authentication methods. After use, it should be freed
120  * with modest_pair_list_free
121  */
122 ModestPairList*   modest_protocol_info_get_protocol_auth_pair_list ();
123
124
125 /**
126  * modest_protocol_info_get_protocol_type:
127  * @proto: the ModestProtocol you'd like to query for its type
128  *
129  * return ModestProtocolType for the protocol
130  *  
131  * Returns: the protocol type or MODEST_PROTOCOL_TYPE_UNKNOWN
132  */
133 ModestProtocolType modest_protocol_info_get_protocol_type (ModestProtocol proto);
134
135
136 /**
137  * modest_protocol_info_get_protocol_type:
138  * @name: the name of the  ModestProtocol
139  *
140  * return the id of the protocol with the given name
141  *  
142  * Returns: the id of the protocol or MODEST_PROTOCOL_UNKNOWN
143  */
144 ModestProtocol modest_protocol_info_get_protocol (const gchar* name);
145
146
147 /**
148  * modest_protocol_info_get_protocol_name:
149  * @proto: the protocol you are looking for
150  *
151  * return the string id of the proto (such as "imap", or "tls")
152  *  
153  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
154  */
155 const gchar* modest_protocol_info_get_protocol_name (ModestProtocol proto);
156
157 /**
158  * modest_protocol_info_get_protocol_display_name:
159  * @proto: the protocol you are looking for
160  *
161  * return the string id of the proto (such as "imap", or "tls")
162  *  
163  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
164  *
165  */
166 const gchar* modest_protocol_info_get_protocol_display_name (ModestProtocol proto);
167
168
169
170 /**
171  * modest_protocol_info_protocol_is_local_store:
172  * @proto: the protocol
173  *
174  * is this protocol a local store protocol?
175  *  
176  * Returns: TRUE if it is a local store, FALSE otherwise
177  *
178  */
179 gboolean modest_protocol_info_protocol_is_local_store (ModestProtocol proto);
180
181
182
183
184 G_END_DECLS
185 #endif /* __MODEST_PROTOCOL_INFO_H__ */
186