* Removed the ModestTnyAttachment stuff
[modest] / src / modest-account-mgr.c
index 9cca65e..1338304 100644 (file)
  */
 
 #include <string.h>
-#include <modest-marshal.h>
-#include <modest-account-keys.h>
-#include <modest-account-mgr.h>
+#include "modest-proto.h"
+#include "modest-marshal.h"
+#include "modest-account-keys.h"
+#include "modest-account-mgr.h"
 
 /* 'private'/'protected' functions */
 static void modest_account_mgr_class_init (ModestAccountMgrClass * klass);
@@ -357,6 +358,7 @@ modest_account_mgr_add_server_account (ModestAccountMgr * self,
 {
        ModestAccountMgrPrivate *priv;
        gchar *key;
+       ModestProtoType proto_type = MODEST_PROTO_TYPE_ANY;
 
        g_return_val_if_fail (self, FALSE);
        g_return_val_if_fail (name, FALSE);
@@ -390,6 +392,14 @@ modest_account_mgr_add_server_account (ModestAccountMgr * self,
        modest_conf_set_string (priv->modest_conf, key, null_means_empty (proto), NULL);
        g_free (key);
        
+       /* type */
+       key = get_account_keyname (name, MODEST_ACCOUNT_TYPE, TRUE);
+       proto_type = modest_proto_type (proto);
+       modest_conf_set_string (priv->modest_conf, key, 
+                               (proto_type == MODEST_PROTO_TYPE_TRANSPORT) ? "transport" : "store", 
+                               NULL);
+       g_free (key);
+
        return TRUE;
 }
 
@@ -433,8 +443,8 @@ void
 strip_prefix_from_elements (GSList * lst, guint n)
 {
        while (lst) {
-               memmove (lst->data + n, lst->data,
-                        strlen(lst->data) + 1);
+               memmove (lst->data, lst->data + n,
+                        strlen(lst->data) - n + 1);
                lst = lst->next;
        }
 }
@@ -782,6 +792,29 @@ modest_account_mgr_set_bool (ModestAccountMgr * self, const gchar * name,
        return retval;
 }
 
+void 
+modest_account_mgr_set_list (ModestAccountMgr *self,
+                            const gchar *name,
+                            const gchar *key,
+                            GSList *val,
+                            ModestConfValueType list_type,
+                            gboolean server_account,
+                            GError **err)
+{
+       ModestAccountMgrPrivate *priv;
+       gchar *keyname;
+       
+       g_return_if_fail (self);
+       g_return_if_fail (name);
+       g_return_if_fail (key);
+       g_return_if_fail (val);
+
+       keyname = get_account_keyname (name, key, server_account);
+       
+       priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
+       modest_conf_set_list (priv->modest_conf, keyname, val, list_type, err);
+       g_free (keyname);
+}
 
 gboolean
 modest_account_mgr_account_exists (ModestAccountMgr * self, const gchar * name,