aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-migrate.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-12-03 11:38:03 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-12-03 11:38:03 +0800
commit8652353f286c3cacb888573b3fe1e7263b41a92c (patch)
tree6f02b6262fcd919865c9ba51881a12fe29021762 /mail/em-migrate.c
parentc83477345fa5dceb62b85efd0a76a54f94a78858 (diff)
downloadgsoc2013-evolution-8652353f286c3cacb888573b3fe1e7263b41a92c.tar.gz
gsoc2013-evolution-8652353f286c3cacb888573b3fe1e7263b41a92c.tar.zst
gsoc2013-evolution-8652353f286c3cacb888573b3fe1e7263b41a92c.zip
Moved various things from e-util to libedataserver.
2004-11-15 Not Zed <NotZed@Ximian.com> * *.c: Moved various things from e-util to libedataserver. * GNOME_Evolution_Mail.server.in.in: remove the startup wizard stuff. * mail-config-druid.[ch]: * mail-account-editor.[ch]: * mail-account-gui.[ch]: removed & deleted. * mail-session.c (mail_session_init): and here too. * em-migrate.c (em_migrate_1_4): init camel-provider library too. (e_path_to_physical): copy from e-util/e-path.c. * Makefile.am (libevolution_mail_la_LIBADD): link to new libcamel provider too. svn path=/trunk/; revision=28047
Diffstat (limited to 'mail/em-migrate.c')
-rw-r--r--mail/em-migrate.c83
1 files changed, 81 insertions, 2 deletions
diff --git a/mail/em-migrate.c b/mail/em-migrate.c
index 87d200e2b8..d2c9c1909c 100644
--- a/mail/em-migrate.c
+++ b/mail/em-migrate.c
@@ -42,6 +42,7 @@
#include <libgnome/gnome-config.h>
#include <camel/camel.h>
+#include <camel/camel-store.h>
#include <camel/camel-session.h>
#include <camel/camel-file-utils.h>
#include <camel/camel-disco-folder.h>
@@ -53,13 +54,12 @@
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
-#include <gal/util/e-iconv.h>
+#include <libedataserver/e-iconv.h>
#include <gal/util/e-xml-utils.h>
#include "e-util/e-bconf-map.h"
#include "e-util/e-account-list.h"
#include "e-util/e-signature-list.h"
-#include "e-util/e-path.h"
#include "widgets/misc/e-error.h"
#include "mail-config.h"
@@ -2315,6 +2315,84 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException *
return 0;
}
+#define SUBFOLDER_DIR_NAME "subfolders"
+#define SUBFOLDER_DIR_NAME_LEN 10
+
+static char *
+e_path_to_physical (const char *prefix, const char *vpath)
+{
+ const char *p, *newp;
+ char *dp;
+ char *ppath;
+ int ppath_len;
+ int prefix_len;
+
+ while (*vpath == '/')
+ vpath++;
+ if (!prefix)
+ prefix = "";
+
+ /* Calculate the length of the real path. */
+ ppath_len = strlen (vpath);
+ ppath_len++; /* For the ending zero. */
+
+ prefix_len = strlen (prefix);
+ ppath_len += prefix_len;
+ ppath_len++; /* For the separating slash. */
+
+ /* Take account of the fact that we need to translate every
+ * separator into `subfolders/'.
+ */
+ p = vpath;
+ while (1) {
+ newp = strchr (p, '/');
+ if (newp == NULL)
+ break;
+
+ ppath_len += SUBFOLDER_DIR_NAME_LEN;
+ ppath_len++; /* For the separating slash. */
+
+ /* Skip consecutive slashes. */
+ while (*newp == '/')
+ newp++;
+
+ p = newp;
+ };
+
+ ppath = g_malloc (ppath_len);
+ dp = ppath;
+
+ memcpy (dp, prefix, prefix_len);
+ dp += prefix_len;
+ *(dp++) = '/';
+
+ /* Copy the mangled path. */
+ p = vpath;
+ while (1) {
+ newp = strchr (p, '/');
+ if (newp == NULL) {
+ strcpy (dp, p);
+ break;
+ }
+
+ memcpy (dp, p, newp - p + 1); /* `+ 1' to copy the slash too. */
+ dp += newp - p + 1;
+
+ memcpy (dp, SUBFOLDER_DIR_NAME, SUBFOLDER_DIR_NAME_LEN);
+ dp += SUBFOLDER_DIR_NAME_LEN;
+
+ *(dp++) = '/';
+
+ /* Skip consecutive slashes. */
+ while (*newp == '/')
+ newp++;
+
+ p = newp;
+ }
+
+ return ppath;
+}
+
static int
em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex)
{
@@ -2403,6 +2481,7 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders
path = g_build_filename (evolution_dir, "mail", NULL);
camel_init (path, TRUE);
+ camel_provider_init();
session = (EMMigrateSession *) em_migrate_session_new (path);
g_free (path);