Fixes NB#138269, append @hotmail.com to the username if the user haven't inserted it
[modest] / src / modest-server-account-settings.h
1 /* Copyright (c) 2007, 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
31 /* modest-server-account-settings.h */
32
33 #ifndef __MODEST_SERVER_ACCOUNT_SETTINGS_H__
34 #define __MODEST_SERVER_ACCOUNT_SETTINGS_H__
35
36 #include <glib-object.h>
37 #include <modest-protocol.h>
38
39 G_BEGIN_DECLS
40
41 /* convenience macros */
42 #define MODEST_TYPE_SERVER_ACCOUNT_SETTINGS             (modest_server_account_settings_get_type())
43 #define MODEST_SERVER_ACCOUNT_SETTINGS(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS,ModestServerAccountSettings))
44 #define MODEST_SERVER_ACCOUNT_SETTINGS_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS,ModestServerAccountSettingsClass))
45 #define MODEST_IS_SERVER_ACCOUNT_SETTINGS(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS))
46 #define MODEST_IS_SERVER_ACCOUNT_SETTINGS_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS))
47 #define MODEST_SERVER_ACCOUNT_SETTINGS_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS,ModestServerAccountSettingsClass))
48
49 typedef struct _ModestServerAccountSettings      ModestServerAccountSettings;
50 typedef struct _ModestServerAccountSettingsClass ModestServerAccountSettingsClass;
51
52 struct _ModestServerAccountSettings {
53         GObject parent;
54 };
55
56 struct _ModestServerAccountSettingsClass {
57         GObjectClass parent_class;
58 };
59
60
61 /**
62  * modest_server_account_settings_get_type:
63  *
64  * Returns: GType of the account store
65  */
66 GType  modest_server_account_settings_get_type   (void) G_GNUC_CONST;
67
68 /**
69  * modest_server_account_settings_new:
70  *
71  * creates a new instance of #ModestServerAccountSettings
72  *
73  * Returns: a #ModestServerAccountSettings
74  */
75 ModestServerAccountSettings*    modest_server_account_settings_new (void);
76
77 /**
78  * modest_server_account_settings_get_hostname:
79  * @settings: a #ModestServerAccountSettings
80  *
81  * get the server hostname.
82  *
83  * Returns: a string
84  */
85 const gchar* modest_server_account_settings_get_hostname (ModestServerAccountSettings *settings);
86
87 /**
88  * modest_server_account_settings_set_hostname:
89  * @settings: a #ModestServerAccountSettings
90  * @hostname: a string.
91  *
92  * set @hostname as the server hostname.
93  */
94 void         modest_server_account_settings_set_hostname (ModestServerAccountSettings *settings,
95                                                                       const gchar *hostname);
96
97 /**
98  * modest_server_account_settings_get_protocol:
99  * @settings: a #ModestServerAccountSettings
100  *
101  * get the server protocol.
102  *
103  * Returns: a #ModestProtocolType
104  */
105 ModestProtocolType modest_server_account_settings_get_protocol (ModestServerAccountSettings *settings);
106
107 /**
108  * modest_server_account_settings_set_protocol:
109  * @settings: a #ModestServerAccountSettings
110  * @protocol: a #ModestProtocolType
111  *
112  * set @server_type.
113  */
114 void                          modest_server_account_settings_set_protocol (ModestServerAccountSettings *settings,
115                                                                            ModestProtocolType protocol_type);
116
117
118 /**
119  * modest_server_account_settings_get_uri:
120  * @settings: a #ModestServerAccountSettings
121  *
122  * get the uri, if any. If this is set, then all the other fields are invalid. It's only valid if protocol is %NULL.
123  *
124  * Returns: a string
125  */
126 const gchar *modest_server_account_settings_get_uri (ModestServerAccountSettings *settings);
127
128 /**
129  * modest_server_account_settings_set_uri:
130  * @settings: a #ModestServerAccountSettings
131  * @uri: a string
132  *
133  * set @uri. When you set an @uri, then the protocol is set to %MODEST_PROTOCOL_REGISTRY_TYPE_INVALID. This is used for setting maildir or mbox
134  * accounts.
135  */
136 void   modest_server_account_settings_set_uri (ModestServerAccountSettings *settings,
137                                                const gchar *uri);
138
139 /**
140  * modest_server_account_settings_get_port:
141  * @settings: a #ModestServerAccountSettings
142  *
143  * get the server port.
144  *
145  * Returns: a #guint
146  */
147 guint  modest_server_account_settings_get_port (ModestServerAccountSettings *settings);
148
149 /**
150  * modest_server_account_settings_set_port:
151  * @settings: a #ModestServerAccountSettings
152  * @port: a #guint.
153  *
154  * set @port.
155  */
156 void   modest_server_account_settings_set_port (ModestServerAccountSettings *settings,
157                                                 guint port);
158
159 /**
160  * modest_server_account_settings_get_username:
161  * @settings: a #ModestServerAccountSettings
162  *
163  * get the username.
164  *
165  * Returns: a string
166  */
167 const gchar *modest_server_account_settings_get_username (ModestServerAccountSettings *settings);
168
169 /**
170  * modest_server_account_settings_set_username:
171  * @settings: a #ModestServerAccountSettings
172  * @username: a string
173  *
174  * set @username.
175  */
176 void   modest_server_account_settings_set_username (ModestServerAccountSettings *settings,
177                                                     const gchar *username);
178
179 /**
180  * modest_server_account_settings_get_password:
181  * @settings: a #ModestServerAccountSettings
182  *
183  * get the password.
184  *
185  * Returns: a string
186  */
187 const gchar *modest_server_account_settings_get_password (ModestServerAccountSettings *settings);
188
189 /**
190  * modest_server_account_settings_set_password:
191  * @settings: a #ModestServerAccountSettings
192  * @password: a string
193  *
194  * set @password.
195  */
196 void   modest_server_account_settings_set_password (ModestServerAccountSettings *settings,
197                                                     const gchar *password);
198
199
200 /**
201  * modest_server_account_settings_get_security_protocol:
202  * @settings: a #ModestServerAccountSettings
203  *
204  * get the secure connection type, if any.
205  *
206  * Returns: a #ModestProtocolType
207  */
208 ModestProtocolType modest_server_account_settings_get_security_protocol (ModestServerAccountSettings *settings);
209
210 /**
211  * modest_server_account_settings_set_security_protocol:
212  * @settings: a #ModestServerAccountSettings
213  * @security: a #ModestProtocolType
214  *
215  * set the current security connection protocol to @security.
216  */
217 void   modest_server_account_settings_set_security_protocol (ModestServerAccountSettings *settings,
218                                                              ModestProtocolType security_protocol);
219
220
221 /**
222  * modest_server_account_settings_get_auth_protocol:
223  * @settings: a #ModestServerAccountSettings
224  *
225  * get the authentication protocol
226  *
227  * Returns: a #ModestProtocolType
228  */
229 ModestProtocolType modest_server_account_settings_get_auth_protocol (ModestServerAccountSettings *settings);
230
231 /**
232  * modest_server_account_settings_set_auth_protocol:
233  * @settings: a #ModestServerAccountSettings
234  * @auth_protocol: a #ModestProtocolType
235  *
236  * set the current authentication protocol to @auth_protocol.
237  */
238 void   modest_server_account_settings_set_auth_protocol (ModestServerAccountSettings *settings,
239                                                          ModestProtocolType auth_protocol);
240
241 /**
242  * modest_server_account_settings_get_account_name:
243  * @settings: a #ModestServerAccountSettings
244  *
245  * get the #ModestAccountMgr account name for these settings, or
246  * %NULL if it's not in the manager.
247  *
248  * Returns: a string, or %NULL
249  */
250 const gchar *modest_server_account_settings_get_account_name (ModestServerAccountSettings *settings);
251
252 /**
253  * modest_server_account_settings_set_account_name:
254  * @settings: a #ModestServerAccountSettings
255  * @account_name: a string
256  *
257  * sets the account name that will be used to store the account settings. This should
258  * only be called from #ModestAccountMgr and #ModestAccountSettings.
259  */
260 void modest_server_account_settings_set_account_name (ModestServerAccountSettings *settings,
261                                                       const gchar *account_name);
262
263
264 G_END_DECLS
265
266 #endif /* __MODEST_SERVER_ACCOUNT_SETTINGS_H__ */