This is my first post to this list and I am still learning the GNU
development tool set, so please bear with me. There is/was a bug in the
LDIF importer module such that the imported addresses would always be
added to the base Contacts folder, regardless of user selection. I have
corrected this and have included the patch below. I have a feeling this
may have been fixed but after searching the discussion list archives I
found no mention of such a fix.

BTW, I also have tools for converting KMail address book CSV files to
LDIF files and converting KMail mailbox hierarchies to Evolution mail
folders. If anyone is interested in them, feel free to let me know and
I'll share them.

Marten.


--- evolution-ldif-importer.c.old       Sat Feb 16 13:05:53 2002
+++ evolution-ldif-importer.c   Sat Feb 16 13:20:05 2002
@@ -34,6 +34,7 @@
 
 typedef struct {
        char *filename;
+       char *folderpath;
        GList *cardlist;
        GList *iterator;
        EBook *book;
@@ -157,7 +158,7 @@
 {
        int state = 0;
        unsigned int save = 0;
-
+ 
        return base64_decode_step ((unsigned char *)data, len,
                                   (unsigned char *)data, &state, &save);
 }
@@ -449,8 +450,10 @@
 static void
 ebook_create (LDIFImporter *gci)
 {
-       gchar *path, *uri;
-       
+       gchar *path; 
+       gchar *uri;
+       gchar *epath;
+
        gci->book = e_book_new ();
 
        if (!gci->book) {
@@ -461,10 +464,15 @@
        }
 
        path = g_concat_dir_and_file (g_get_home_dir (),
-                                     "evolution/local/Contacts/addressbook.db");
+                                     "evolution/local");
        uri = g_strdup_printf ("file://%s", path);
        g_free (path);
 
+       epath = e_path_to_physical (uri, gci->folderpath);
+       g_free (uri);
+       uri = g_strdup_printf ("%s/addressbook.db", epath);
+       g_free (epath);
+
        if (! e_book_load_uri (gci->book, uri, book_open_cb, gci)) {
                printf ("error calling load_uri!\n");
        }
@@ -559,6 +567,7 @@
 
        gci = (LDIFImporter *) closure;
        gci->filename = g_strdup (filename);
+       gci->folderpath = g_strdup (folderpath);
        gci->cardlist = NULL;
        gci->iterator = NULL;
        gci->ready = FALSE;

Reply via email to