#define __MODEST_ACCOUNT_MGR_HELPERS_H__
#include <modest-account-mgr.h>
+#include <modest-tny-account-store.h>
+
+#include <tny-account.h>
+#include <tny-store-account.h>
+#include <tny-transport-account.h>
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;
+ gchar *password;
+ time_t last_updated;
+ 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
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
+ */
+gboolean modest_account_mgr_set_default_account (ModestAccountMgr *self,
+ const gchar* account);
+
+/**
+ * modest_account_mgr_free_account_data:
+ * @self: a ModestAccountMgr instance
+ * @data: a ModestAccountData instance
+ *
+ * free the account data structure
*/
-GSList* modest_account_mgr_search_server_accounts (ModestAccountMgr *self,
- const gchar* account_name,
- ModestProtocolType type,
- ModestProtocol proto);
+void modest_account_mgr_free_account_data (ModestAccountMgr *self,
+ ModestAccountData *data);
/**
- * modest_account_mgr_account_set_enabled
+ * 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
*
* 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
*
*
* 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_account_mgr_get_from_string
+ * @self: a #ModestAccountMgr instance
+ * @name: the account name
+ *
+ * get the From: string for some account; ie. "Foo Bar" <foo.bar@cuux.yy>"
+ *
+ * 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