aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/mail-local.c42
-rw-r--r--mail/mail-local.h1
-rw-r--r--mail/mail-tools.c15
4 files changed, 64 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 93dbd157e9..20159c30ba 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
2000-08-10 Christopher James Lahey <clahey@helixcode.com>
* folder-browser-factory.c, message-list.c, message-thread.c,
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);
}
diff --git a/mail/mail-local.h b/mail/mail-local.h
index 331832cfc8..c5892d29d9 100644
--- a/mail/mail-local.h
+++ b/mail/mail-local.h
@@ -32,5 +32,6 @@
/* mail-local.c */
CamelFolder *mail_tool_local_uri_to_folder(const char *uri, CamelException *ex);
void local_reconfigure_folder(FolderBrowser *fb);
+char *mail_local_map_uri(const char *uri);
#endif
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index de4be18a07..dba9a60d3c 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -120,6 +120,17 @@ mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
gchar *
mail_tool_get_local_inbox_url (void)
{
+ char *uri, *new;
+
+ uri = g_strdup_printf("file://%s/local/Inbox", evolution_dir);
+ new = mail_local_map_uri(uri);
+ g_free(uri);
+ return new;
+}
+
+gchar *
+mail_tool_get_local_movemail_url (void)
+{
return g_strdup_printf ("mbox://%s/local/Inbox", evolution_dir);
}
@@ -164,7 +175,7 @@ mail_tool_do_movemail (const gchar *source_url, CamelException *ex)
/* Set up our destination. */
- dest_url = mail_tool_get_local_inbox_url();
+ dest_url = mail_tool_get_local_movemail_url();
dest_path = mail_tool_get_local_movemail_path();
/* Create a new movemail mailbox file of 0 size */
@@ -447,7 +458,7 @@ mail_tool_fetch_mail_into_searchable (const char *source_url, gboolean keep_on_s
* so that the folder browser can search it. */
gchar *url;
- url = mail_tool_get_local_inbox_url();
+ url = mail_tool_get_local_movemail_url();
search_folder = mail_tool_get_folder_from_urlname (url, "movemail", TRUE, ex);
g_free (url);
if (camel_exception_is_set (ex))