2007-04-18 Murray Cumming <murrayc@murrayc.com>
[modest] / src / modest-account-mgr-helpers.h
index 61cef7d..8a09475 100644 (file)
 G_BEGIN_DECLS
 
 typedef struct {
-       TnyAccount    *tny_account;
-       gchar         *account_name;
-       gchar         *hostname;
-       gchar         *username;
-       ModestProtocol proto;
-       gchar         *password;
-       GSList        *options;
+       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;
@@ -110,8 +113,6 @@ gboolean modest_account_mgr_set_default_account  (ModestAccountMgr *self,
 void       modest_account_mgr_free_account_data     (ModestAccountMgr *self,
                                                     ModestAccountData *data);
 
-
-
 /**
  * modest_account_mgr_set_enabled
  * @self: a ModestAccountMgr instance
@@ -136,22 +137,81 @@ gboolean modest_account_mgr_set_enabled (ModestAccountMgr *self, const gchar* na
  */
 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_account_mgr_get_tny_account:
- * @self: a #ModestAccountMgr instance
- * @name: the account name
- * @type: the #TnyAccountType to check; either TNY_ACCOUNT_TYPE_TRANSPORT or TNY_ACCOUNT_TYPE_STORE
+ * modest_server_account_set_option_security:
+ * @self: a ModestAccountMgr instance
+ * @secure_auth: The security enum value.
  *
- * get the TnyAccount corresponding to the store/transport (server) accounts for some account.
- * ie., every account has two server accounts, and for every server account there is a corresponding
- * TnyAccount 
+ * 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 requested TnyAccount, or NULL in case of error
+ * Returns: The account option value. This must be freed with g_free().
  */
-TnyAccount*  modest_account_mgr_get_tny_account (ModestAccountMgr *self, const gchar* name,
-                                                TnyAccountType type);
+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