From e5315bc0c4faa64bf721d5b987e565e57733e5b7 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 27 Apr 2004 19:32:10 +0000 Subject: Migrate pilot data. (migrate_pilot_data): Oops. Apparently the addressbook 2004-04-27 Jeffrey Stedfast * gui/component/addressbook-migrate.c (addressbook_migrate): Migrate pilot data. (migrate_pilot_data): Oops. Apparently the addressbook didn't change the format of the changelog file from db3 to xml, so fix to simply copy the file over. svn path=/trunk/; revision=25639 --- addressbook/gui/component/addressbook-migrate.c | 46 +++---------------------- 1 file changed, 5 insertions(+), 41 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c index 9b84e8ba8d..a6b21899bf 100644 --- a/addressbook/gui/component/addressbook-migrate.c +++ b/addressbook/gui/component/addressbook-migrate.c @@ -31,8 +31,6 @@ #include "addressbook-migrate.h" #include "e-destination.h" #include -#include -#include #include #include #include @@ -941,14 +939,6 @@ migrate_company_phone_for_local_folders (MigrationContext *context, ESourceGroup } } -static void -migrate_pilot_db_key (const char *key, const char *data, gpointer user_data) -{ - EXmlHash *xmlhash = user_data; - - e_xmlhash_add (xmlhash, key, data); -} - static void migrate_pilot_data (const char *old_path, const char *new_path) { @@ -961,9 +951,11 @@ migrate_pilot_data (const char *old_path, const char *new_path) return; while ((dent = readdir (dir))) { - if (!strncmp (dent->d_name, "pilot-map-", 10) && - ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".xml"))) { - /* pilot map file - src and dest file formats are identical */ + if ((!strncmp (dent->d_name, "pilot-map-", 10) && + ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".xml"))) || + (!strncmp (dent->d_name, "pilot-sync-evolution-addressbook-", 33) && + ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".db")))) { + /* src and dest file formats are identical for both map and changelog files */ unsigned char inbuf[4096]; size_t nread, nwritten; int fd0, fd1; @@ -1017,34 +1009,6 @@ migrate_pilot_data (const char *old_path, const char *new_path) close (fd0); close (fd1); g_free (filename); - } else if (!strncmp (dent->d_name, "pilot-sync-evolution-addressbook-", 33) && - ((ext = strrchr (dent->d_name, '.')) && !strcmp (ext, ".db"))) { - /* src and dest formats differ, src format is db3 while dest format is xml */ - EXmlHash *xmlhash; - EDbHash *dbhash; - struct stat st; - - filename = g_build_filename (old_path, dent->d_name, NULL); - if (stat (filename, &st) == -1) { - g_free (filename); - continue; - } - - dbhash = e_dbhash_new (filename); - g_free (filename); - - filename = g_build_filename (new_path, dent->d_name, NULL); - if (stat (filename, &st) != -1) - unlink (filename); - xmlhash = e_xmlhash_new (filename); - g_free (filename); - - e_dbhash_foreach_key (dbhash, migrate_pilot_db_key, xmlhash); - - e_dbhash_destroy (dbhash); - - e_xmlhash_write (xmlhash); - e_xmlhash_destroy (xmlhash); } } -- cgit v1.2.3