diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-08-11 11:50:39 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-08-11 11:50:39 +0800 |
commit | dfa46fe1d19552c600ae3b6190a056c7ac51dac1 (patch) | |
tree | 296878019b414d3b8e8949df06a48fb3e95aa15a /mail/mail-local.c | |
parent | 3834c823592912bcaf881cb94e949612ce29baf2 (diff) | |
download | gsoc2013-evolution-dfa46fe1d19552c600ae3b6190a056c7ac51dac1.tar.gz gsoc2013-evolution-dfa46fe1d19552c600ae3b6190a056c7ac51dac1.tar.zst gsoc2013-evolution-dfa46fe1d19552c600ae3b6190a056c7ac51dac1.zip |
Properly handle different local file formats. The folder isn't always
2000-08-11 Not Zed <NotZed@HelixCode.com>
* mail-tools.c (mail_tool_get_local_inbox_url): Properly handle
different local file formats. The folder isn't always mbox.
(mail_tool_do_movemail): Movemail always uses an mbox format
however.
(mail_tool_get_local_movemail_url): What is the mbox url, it is
always the same type, mbox.
(mail_tool_fetch_mail_into_searchable): Same here.
* mail-local.c (mail_local_map_uri): Map a local uri to the real uri.
svn path=/trunk/; revision=4724
Diffstat (limited to 'mail/mail-local.c')
-rw-r--r-- | mail/mail-local.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/mail/mail-local.c b/mail/mail-local.c index 02f856b769..883d10926c 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -132,6 +132,41 @@ save_metainfo(struct _local_meta *meta) return ret; } +/* maps a local uri to the real type */ +char * +mail_local_map_uri(const char *uri) +{ + CamelURL *url; + char *metapath; + char *storename; + struct _local_meta *meta; + CamelException *ex; + + if (strncmp(uri, "file:", 5)) { + g_warning("Trying to map non-local uri: %s", uri); + return g_strdup(uri); + } + + ex = camel_exception_new(); + url = camel_url_new(uri, ex); + if (camel_exception_is_set(ex)) { + camel_exception_free(ex); + return g_strdup(uri); + } + camel_exception_free(ex); + + metapath = g_strdup_printf("%s/local-metadata.xml", url->path); + meta = load_metainfo(metapath); + g_free(metapath); + + /* change file: to format: */ + camel_url_set_protocol(url, meta->format); + storename = camel_url_to_string(url, TRUE); + camel_url_free(url); + + return storename; +} + CamelFolder * mail_tool_local_uri_to_folder(const char *uri, CamelException *ex) { @@ -341,6 +376,7 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex) goto cleanup; } + update_progress("Copying messages", 0.0); mail_tool_move_folder_contents (fromfolder, tofolder, FALSE, ex); printf("delete old mbox ...\n"); @@ -373,10 +409,8 @@ do_reconfigure_folder(gpointer in_data, gpointer op_data, CamelException *ex) camel_object_unref (CAMEL_OBJECT (fromstore)); if (tostore) camel_object_unref (CAMEL_OBJECT (tostore)); - if (fromurl) - g_free(fromurl); - if (tourl) - g_free(tourl); + g_free(fromurl); + g_free(tourl); if (url) camel_url_free (url); } |