X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-account-mgr-helpers.h;h=8a09475801625995a5fa612eb90531304cf212c0;hp=d122dafb08e59a152e3970ba092ce78fc9a2d969;hb=3f42b5ae96903964c4eddb9dcebd223ef5925d6b;hpb=5024de84b7959b0b3373176d8c1f91a73427ff88 diff --git a/src/modest-account-mgr-helpers.h b/src/modest-account-mgr-helpers.h index d122daf..8a09475 100644 --- a/src/modest-account-mgr-helpers.h +++ b/src/modest-account-mgr-helpers.h @@ -32,27 +32,39 @@ #define __MODEST_ACCOUNT_MGR_HELPERS_H__ #include +#include + +#include +#include +#include G_BEGIN_DECLS typedef struct { - gchar *account_name; - gchar *hostname; - gchar *username; - ModestProtocol proto; - gchar *password; + gchar *account_name; + gchar *hostname; + gchar *username; + gchar *uri; + ModestProtocol proto; /*< The store or transport. Not ORed. */ + gchar *password; + time_t last_updated; + gint port; /* Or 0, if the default should be used. */ + GSList *options; } ModestServerAccountData; typedef struct { - gchar *account_name; - gchar *display_name; - gchar *fullname; - gchar *email; - gboolean enabled; + gchar *account_name; + gchar *display_name; + gchar *fullname; + gchar *email; + gboolean is_enabled; + gboolean is_default; ModestServerAccountData *transport_account; ModestServerAccountData *store_account; } ModestAccountData; + + /** * modest_account_mgr_get_account_data: * @self: a ModestAccountMgr instance @@ -68,38 +80,41 @@ typedef struct { ModestAccountData *modest_account_mgr_get_account_data (ModestAccountMgr *self, const gchar* name); - /** - * modest_account_mgr_free_account_data: + * modest_account_mgr_get_default_account: * @self: a ModestAccountMgr instance - * @data: a ModestAccountData instance * - * free the account data structure + * get the default account name, or NULL if none is found + * + * Returns: the default account name (as newly allocated string, which + * must be g_free'd), or NULL */ -void modest_account_mgr_free_account_data (ModestAccountMgr *self, - ModestAccountData *data); - +gchar* modest_account_mgr_get_default_account (ModestAccountMgr *self); /** - * modest_account_mgr_server_account_names: + * modest_account_mgr_get_default_account: * @self: a ModestAccountMgr instance - * @account_name: get only server accounts for @account_name, or NULL for any - * @type: get only server accounts from protocol type @type, or MODEST_PROTO_TYPE_ANY - * @proto: get only server account with protocol @proto, or NULL for any - * @only_enabled: get only enabled server accounts if TRUE + * @account: the name of an existing account * - * list all the server account names + * set the default account name (which must be valid account) * - * Returns: a newly allocated list of server account names, or NULL in case of - * error or if there are no server accounts. The caller must free the returned GSList + * Returns: TRUE if succeeded, FALSE otherwise */ -GSList* modest_account_mgr_search_server_accounts (ModestAccountMgr *self, - const gchar* account_name, - ModestProtocolType type, - ModestProtocol proto); +gboolean modest_account_mgr_set_default_account (ModestAccountMgr *self, + const gchar* account); /** - * modest_account_mgr_account_set_enabled + * modest_account_mgr_free_account_data: + * @self: a ModestAccountMgr instance + * @data: a ModestAccountData instance + * + * free the account data structure + */ +void modest_account_mgr_free_account_data (ModestAccountMgr *self, + ModestAccountData *data); + +/** + * modest_account_mgr_set_enabled * @self: a ModestAccountMgr instance * @name: the account name * @enabled: if TRUE, the account will be enabled, if FALSE, it will be disabled @@ -108,12 +123,11 @@ GSList* modest_account_mgr_search_server_accounts (ModestAccountMgr *self, * * Returns: TRUE if it worked, FALSE otherwise */ -gboolean modest_account_mgr_account_set_enabled (ModestAccountMgr *self, const gchar* name, - gboolean enabled); - +gboolean modest_account_mgr_set_enabled (ModestAccountMgr *self, const gchar* name, + gboolean enabled); /** - * modest_account_mgr_account_get_enabled: + * modest_account_mgr_get_enabled: * @self: a ModestAccountMgr instance * @name: the account name to check * @@ -121,7 +135,94 @@ gboolean modest_account_mgr_account_set_enabled (ModestAccountMgr *self, const g * * Returns: TRUE if it is enabled, FALSE otherwise */ -gboolean modest_account_mgr_account_get_enabled (ModestAccountMgr *self, const gchar* name); +gboolean modest_account_mgr_get_enabled (ModestAccountMgr *self, const gchar* name); + +/** + * modest_server_account_get_option_secure_auth: + * @self: a ModestAccountMgr instance + * @account_name: The name of a server account. + * + * Gets the secure authentication method for this server account. + * + * Returns: The secure authentication enum value. + */ +ModestProtocol +modest_server_account_get_option_secure_auth (ModestAccountMgr *self, const gchar* account_name); + +/** + * modest_server_account_data_get_option_secure_auth: + * @self: a ModestAccountMgr instance + * @account_name: The name of a server account. + * @secure_auth: The secure authentication enum value. + * + * Gets the secure authentication method for this server account. + */ +void +modest_server_account_set_option_secure_auth (ModestAccountMgr *self, const gchar* account_name, + ModestProtocol secure_auth); + +/** + * modest_server_account_data_get_option_security: + * @account_data: a ModestAccountData instance. + * + * Gets the security method for this server account. + * + * Returns: The security enum value. + */ +ModestProtocol +modest_server_account_data_get_option_security (ModestServerAccountData *account_data); + +/** + * modest_server_account_set_option_security: + * @self: a ModestAccountMgr instance + * @secure_auth: The security enum value. + * + * Gets the security method for this server account. + */ +void +modest_server_account_set_option_security (ModestAccountMgr *self, const gchar* account_name, + ModestProtocol security); + +/** + * modest_account_mgr_get_account_option: + * @self: a ModestAccountMgr instance + * @account_name: the account name to check + * @account_name: the option name to check + * + * Returns: The account option value. This must be freed with g_free(). + */ +gchar* modest_account_mgr_get_server_account_option (ModestAccountMgr *self, + const gchar* account_name, const gchar* option_name); + +/** + * modest_server_account_data_get_option_value: + * @options_list: a ModestServerAccountData::options list. + * @option_name: the option name to check + * + * Returns: The account option value. This must be freed with g_free(). + */ +gchar* modest_server_account_data_get_option_value (GSList* options_list, const gchar* option_name); + +/** + * modest_server_account_data_get_option_bool: + * @options_list: a ModestServerAccountData::options list. + * @option_name: the option name to check + * + * Returns: Whether the account option is present. + */ +gboolean modest_server_account_data_get_option_bool (GSList* options_list, const gchar* option_name); + + +/** + * modest_account_mgr_get_from_string + * @self: a #ModestAccountMgr instance + * @name: the account name + * + * get the From: string for some account; ie. "Foo Bar" " + * + * Returns: the newly allocated from-string, or NULL in case of error + */ +gchar * modest_account_mgr_get_from_string (ModestAccountMgr *self, const gchar* name); G_END_DECLS