* fix the modest-protocol-info for the split enums; note: a couple more commits will...
[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 typedef enum {
39         MODEST_PROTOCOL_TRANSPORT_SENDMAIL,
40         MODEST_PROTOCOL_TRANSPORT_SMTP,
41
42         MODEST_PROTOCOL_STORE_POP,
43         MODEST_PROTOCOL_STORE_IMAP,
44         MODEST_PROTOCOL_STORE_MAILDIR,
45         MODEST_PROTOCOL_STORE_MBOX
46 } ModestTransportStoreProtocol;
47         
48 typedef enum {    
49         MODEST_PROTOCOL_CONNECTION_NORMAL,
50         MODEST_PROTOCOL_CONNECTION_SSL,   
51         MODEST_PROTOCOL_CONNECTION_TLS,
52         MODEST_PROTOCOL_CONNECTION_TLS_OP
53 } ModestConnectionProtocol;
54
55 typedef enum {    
56         MODEST_PROTOCOL_AUTH_NONE,
57         MODEST_PROTOCOL_AUTH_PASSWORD,
58         MODEST_PROTOCOL_AUTH_CRAMMD5
59 } ModestAuthProtocol;
60
61 typedef enum {
62         MODEST_TRANSPORT_STORE_PROTOCOL,
63         MODEST_CONNECTION_PROTOCOL,
64         MODEST_AUTH_PROTOCOL
65 } ModestProtocolType;
66
67
68 typedef guint ModestProtocol;
69
70 #define MODEST_PROTOCOL_UNKNOWN 666
71
72 /**
73  * modest_protocol_info_get_protocol_pair_list:
74  * @proto_type: the type of protocol you want to have
75  * 
76  * return the list of <protocol,display-name>-tupels of protocols.
77  * The elements of the returned list are ModestPairs
78  * This is a convenience function for use with ModestComboBox
79  *  
80  * Returns: a list of protocols. After use, it should be freed
81  * with modest_pair_list_free
82  */
83 ModestPairList*   modest_protocol_info_get_protocol_pair_list (ModestProtocolType proto_type);
84
85 /**
86  * modest_protocol_info_get_protocol_type:
87  * @name: the name of the  ModestProtocol
88  * @proto_type: the type of protocol you want to have
89  *
90  * return the id of the protocol with the given name
91  *  
92  * Returns: the id of the protocol or MODEST_PROTOCOL_UNKNOWN
93  */
94 ModestProtocol modest_protocol_info_get_protocol (const gchar* name, ModestProtocolType proto_type);
95
96 /**
97  * modest_protocol_info_get_protocol_name:
98  * @proto: the protocol you are looking for
99  * @proto_type: the type of protocol you want to have
100  * 
101  * return the string id of the proto (such as "imap", or "tls")
102  *  
103  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
104  */
105 const gchar* modest_protocol_info_get_protocol_name (ModestProtocol proto,
106                                                      ModestProtocolType proto_type);
107
108 /**
109  * modest_protocol_info_get_protocol_display_name:
110  * @proto: the protocol you are looking for
111  * @proto_type: the type of protocol you want to have
112  *
113  * return the string id of the proto (such as "imap", or "tls")
114  *  
115  * Returns: string id of the proto as a constant string, that should NOT be modified or freed
116  *
117  */
118 const gchar* modest_protocol_info_get_protocol_display_name (ModestProtocol proto,
119                                                              ModestProtocolType proto_type);
120
121
122
123 /**
124  * modest_protocol_info_protocol_is_local_store:
125  * @proto: the protocol
126  *
127  * is this protocol a store protocol?
128  *  
129  * Returns: TRUE if it is a local store, FALSE otherwise
130  *
131  */
132 gboolean modest_protocol_info_protocol_is_store (ModestTransportStoreProtocol proto);
133
134
135 /**
136  * modest_protocol_info_protocol_is_local_store:
137  * @proto: the protocol
138  *
139  * is this protocol a local store protocol?
140  *  
141  * Returns: TRUE if it is a local store, FALSE otherwise
142  *
143  */
144 gboolean modest_protocol_info_protocol_is_local_store (ModestTransportStoreProtocol proto);
145
146
147 G_END_DECLS
148 #endif /* __MODEST_PROTOCOL_INFO_H__ */
149