diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-11-07 06:49:46 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-11-07 06:49:46 +0800 |
commit | e5472b4cc9a4bb80b89437a16f8b77943ea35555 (patch) | |
tree | 9384f8be3e92a570dc1bb93ccfe37eef6dd35537 /mail | |
parent | e6ff03471eb91bf8a5e035f926baaab80aa6ccb4 (diff) | |
download | gsoc2013-evolution-e5472b4cc9a4bb80b89437a16f8b77943ea35555.tar gsoc2013-evolution-e5472b4cc9a4bb80b89437a16f8b77943ea35555.tar.gz gsoc2013-evolution-e5472b4cc9a4bb80b89437a16f8b77943ea35555.tar.bz2 gsoc2013-evolution-e5472b4cc9a4bb80b89437a16f8b77943ea35555.tar.lz gsoc2013-evolution-e5472b4cc9a4bb80b89437a16f8b77943ea35555.tar.xz gsoc2013-evolution-e5472b4cc9a4bb80b89437a16f8b77943ea35555.tar.zst gsoc2013-evolution-e5472b4cc9a4bb80b89437a16f8b77943ea35555.zip |
Call em_migrate_uri() instead of em_uri_from_camel(). (em_migrate_uri):
2003-11-06 Jeffrey Stedfast <fejj@ximian.com>
* em-migrate.c (em_migrate_filter_file): Call em_migrate_uri()
instead of em_uri_from_camel().
(em_migrate_uri): Special-case file: uri's by converting them into
email://local@local/ uri's since these folders will have been
migrated to the newer mbox tree structure.
svn path=/trunk/; revision=23203
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/em-migrate.c | 42 |
2 files changed, 48 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 40f3586395..92ed777799 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,13 @@ 2003-11-06 Jeffrey Stedfast <fejj@ximian.com> + * em-migrate.c (em_migrate_filter_file): Call em_migrate_uri() + instead of em_uri_from_camel(). + (em_migrate_uri): Special-case file: uri's by converting them into + email://local@local/ uri's since these folders will have been + migrated to the newer mbox tree structure. + +2003-11-06 Jeffrey Stedfast <fejj@ximian.com> + * mail-vfolder.c (mail_vfolder_delete_uri): User vfolder rules should be in ${evolution_dir}/mail/vfolders.xml rather than ${evolution_dir}/vfolders.xml diff --git a/mail/em-migrate.c b/mail/em-migrate.c index d404abd3e0..3dbfb760d2 100644 --- a/mail/em-migrate.c +++ b/mail/em-migrate.c @@ -490,7 +490,45 @@ xml_find_node (xmlNodePtr parent, const char *name) return NULL; } -static int +static char * +em_migrate_uri (const char *uri) +{ + char *path, *prefix, *p; + CamelURL *url; + + if (!strncmp (uri, "file:", 5)) { + url = camel_url_new (uri, NULL); + camel_url_set_protocol (url, "email"); + camel_url_set_user (url, "local"); + camel_url_set_host (url, "local"); + + prefix = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); + g_assert (strncmp (url->path, prefix, strlen (prefix)) == 0); + path = g_strdup (url->path + strlen (prefix)); + g_free (prefix); + + /* modify the path in-place */ + p = path + strlen (path) - 12; + while (p > path) { + if (!strncmp (p, "/subfolders/", 12)) + memmove (p, p + 11, strlen (p + 11) + 1); + + p--; + } + + camel_url_set_path (url, path); + g_free (path); + + path = camel_url_to_string (url, 0); + camel_url_free (url); + + return path; + } else { + return em_uri_from_camel (uri); + } +} + +int em_migrate_filter_file (const char *evolution_dir, const char *filename, CamelException *ex) { char *path, *uri, *new; @@ -545,7 +583,7 @@ em_migrate_filter_file (const char *evolution_dir, const char *filename, CamelEx if (type && !strcmp (type, "folder")) { if ((n = xml_find_node (val, "folder"))) { uri = xmlGetProp (n, "uri"); - new = em_uri_from_camel (uri); + new = em_migrate_uri (uri); xmlFree (uri); xmlSetProp (n, "uri", new); |