Do ignore empty recipients when checking names
[modest] / src / modest-account-mgr-helpers.h
index d0a7f58..f10d873 100644 (file)
 #include <tny-account.h>
 #include <tny-store-account.h>
 #include <tny-transport-account.h>
+#include <modest-server-account-settings.h>
 
 G_BEGIN_DECLS
 
-typedef struct {
-       gchar            *account_name;
-       gchar            *hostname;
-       gchar            *username;
-       gchar            *uri; /*< Only for mbox and maildir accounts. */
-       ModestTransportStoreProtocol    proto; /*< The store or transport. Not ORed. */
-       gchar            *password;
-       time_t            last_updated;
-       gint              port; /* Or 0, if the default should be used. */
-       ModestAuthProtocol   secure_auth;
-       ModestConnectionProtocol   security;
-} ModestServerAccountData;
-
-typedef struct {
-       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:
+ * modest_account_mgr_load_account_settings:
  * @self: a ModestAccountMgr instance
  * @name: the name of the account
  * 
  * get information about an account
  *
- * Returns: a ModestAccountData structure with information about the account.
- * the data should not be changed, and be freed with modest_account_mgr_free_account_data
- * The function does a sanity check, an if it's not returning NULL,
- * it is a valid account
+ * Returns: a ModestAccountSettings instance with information about the account,
+ *  or NULL if the account is not valid or does not exist.
  */
-ModestAccountData *modest_account_mgr_get_account_data     (ModestAccountMgr *self,
-                                                           const gchar* name);
+ModestAccountSettings *modest_account_mgr_load_account_settings     (ModestAccountMgr *self,
+                                                                    const gchar* name);
+
+void modest_account_mgr_save_account_settings (ModestAccountMgr *self,
+                                              ModestAccountSettings *settings);
 
 /**
  * modest_account_mgr_set_first_account_as_default:
@@ -98,15 +74,6 @@ modest_account_mgr_set_first_account_as_default  (ModestAccountMgr *self);
 gchar* 
 modest_account_mgr_get_first_account_name (ModestAccountMgr *self);
 
-/**
- * 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
@@ -158,6 +125,19 @@ gboolean modest_account_mgr_set_signature (ModestAccountMgr *self, const gchar*
  */
 gchar* modest_account_mgr_get_signature (ModestAccountMgr *self, const gchar* name, 
        gboolean* use_signature);
+
+gchar *modest_account_mgr_get_signature_from_recipient (ModestAccountMgr *self, const gchar *recipient,
+                                                       gboolean *use_signature);
+
+void modest_account_mgr_get_branding_from_recipient (ModestAccountMgr *mgr, 
+                                                    const gchar *current_recipient, 
+                                                    gchar **service_name,
+                                                    const GdkPixbuf **service_icon,
+                                                    guint64 icon_size);
+
+gboolean modest_account_mgr_account_is_multimailbox (ModestAccountMgr *mgr,
+                                                    const gchar *account_name, 
+                                                    ModestProtocol **mmb_protocol);
        
 /**
  * modest_account_mgr_get_store_protocol:
@@ -168,12 +148,12 @@ gchar* modest_account_mgr_get_signature (ModestAccountMgr *self, const gchar* na
  *
  * Returns: The protocol type.
  */
-ModestTransportStoreProtocol modest_account_mgr_get_store_protocol (ModestAccountMgr *self, const gchar* name);
+ModestProtocolType modest_account_mgr_get_store_protocol (ModestAccountMgr *self, const gchar* name);
 
 /**
  * modest_account_mgr_set_connection_specific_smtp
  * @self: a ModestAccountMgr instance
- * @connection_name: A libconic IAP connection name
+ * @connection_id: A libconic IAP connection name
  * @server_account_name: a server account name to use for this connection.
  * 
  * Specify a server account to use with the specific connection for this account.
@@ -181,19 +161,19 @@ ModestTransportStoreProtocol modest_account_mgr_get_store_protocol (ModestAccoun
  * Returns: TRUE if it worked, FALSE otherwise
  */
 gboolean modest_account_mgr_set_connection_specific_smtp (ModestAccountMgr *self, 
-                                        const gchar* connection_name, const gchar* server_account_name);
+                                        const gchar* connection_id, const gchar* server_account_name);
 
 /**
  * modest_account_mgr_remove_connection_specific_smtp
  * @self: a ModestAccountMgr instance
- * @connection_name: A libconic IAP connection name
+ * @connection_id: A libconic IAP connection name
  * 
  * Disassociate a server account to use with the specific connection for this account.
  *
  * Returns: TRUE if it worked, FALSE otherwise
  */                             
 gboolean modest_account_mgr_remove_connection_specific_smtp (ModestAccountMgr *self, 
-       const gchar* connection_name);
+       const gchar* connection_id);
 
 /**
  * modest_account_mgr_get_use_connection_specific_smtp
@@ -217,14 +197,14 @@ gboolean modest_account_mgr_set_use_connection_specific_smtp (ModestAccountMgr *
 /**
  * modest_account_mgr_get_connection_specific_smtp
  * @self: a ModestAccountMgr instance
- * @connection_name: A libconic IAP connection name
+ * @connection_id: A libconic IAP connection id
  * 
  * Retrieve a server account to use with this specific connection for this account.
  *
  * Returns: a server account name to use for this connection, or NULL if none is specified.
  */                     
 gchar* modest_account_mgr_get_connection_specific_smtp (ModestAccountMgr *self, 
-                                                       const gchar* connection_name);
+                                                       const gchar* connection_id);
 
 
 /**
@@ -342,7 +322,7 @@ void  modest_account_mgr_set_server_account_hostname (ModestAccountMgr *self,
  *
  * Returns: The secure authentication enum value.
  */
-ModestAuthProtocol modest_account_mgr_get_server_account_secure_auth (ModestAccountMgr *self, 
+ModestProtocolType modest_account_mgr_get_server_account_secure_auth (ModestAccountMgr *self, 
                                                                      const gchar* account_name);
 
 /**
@@ -355,7 +335,7 @@ ModestAuthProtocol modest_account_mgr_get_server_account_secure_auth (ModestAcco
  */
 void modest_account_mgr_set_server_account_secure_auth (ModestAccountMgr *self, 
                                                        const gchar* account_name, 
-                                                       ModestAuthProtocol secure_auth);
+                                                       ModestProtocolType secure_auth);
        
 /**
  * modest_server_account_data_get_security:
@@ -364,10 +344,10 @@ void modest_account_mgr_set_server_account_secure_auth (ModestAccountMgr *self,
  *
  * Gets the security method for this server account.
  *
- * Returns: The security enum value.
+ * Returns: The security connection protocol.
  */
-ModestConnectionProtocol modest_account_mgr_get_server_account_security (ModestAccountMgr *self, 
-                                                                        const gchar* account_name);
+ModestProtocolType modest_account_mgr_get_server_account_security (ModestAccountMgr *self, 
+                                                                  const gchar* account_name);
 
 /**
  * modest_account_mgr_set_server_account_security:
@@ -378,24 +358,26 @@ ModestConnectionProtocol modest_account_mgr_get_server_account_security (ModestA
  */
 void modest_account_mgr_set_server_account_security (ModestAccountMgr *self, 
                                                     const gchar* account_name, 
-                                                    ModestConnectionProtocol security);
+                                                    ModestProtocolType security);
 
-ModestServerAccountData* modest_account_mgr_get_server_account_data (ModestAccountMgr *self, 
-                                                                    const gchar* name);
+gboolean modest_account_mgr_save_server_settings (ModestAccountMgr *self,
+                                                 ModestServerAccountSettings *settings);
 
-void modest_account_mgr_free_server_account_data (ModestAccountMgr *self,
-                                                 ModestServerAccountData* data);
+ModestServerAccountSettings *modest_account_mgr_load_server_settings (ModestAccountMgr *self,
+                                                                     const gchar *account_name,
+                                                                     gboolean is_transport_not_store);
 
 /**
  * modest_account_mgr_get_from_string
  * @self: a #ModestAccountMgr instance
  * @name: the account name
+ * @mailbox: the mailbox
  *
  * get the From: string for some account; ie. "Foo Bar" &lt;foo.bar@cuux.yy&gt;"
  *
  * Returns: the newly allocated from-string, or NULL in case of error
  */
-gchar * modest_account_mgr_get_from_string (ModestAccountMgr *self, const gchar* name);
+gchar * modest_account_mgr_get_from_string (ModestAccountMgr *self, const gchar* name, const gchar *mailbox);
 
 
 /**
@@ -462,12 +444,12 @@ gchar* modest_account_mgr_get_server_account_name (ModestAccountMgr *self,
                                                   const gchar *account_name,
                                                   TnyAccountType account_type);
 
-gchar* modest_account_mgr_get_retrieve_type (ModestAccountMgr *self, 
-                                            const gchar *account_name);
+ModestAccountRetrieveType modest_account_mgr_get_retrieve_type (ModestAccountMgr *self, 
+                                                               const gchar *account_name);
 
 void  modest_account_mgr_set_retrieve_type (ModestAccountMgr *self, 
                                            const gchar *account_name,
-                                           const gchar *retrieve_type);
+                                           ModestAccountRetrieveType retrieve_type);
 
 void  modest_account_mgr_set_user_fullname (ModestAccountMgr *self, 
                                            const gchar *account_name,