aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/mail-component.c12
-rw-r--r--mail/mail-send-recv.c5
-rw-r--r--mail/mail-tools.c39
4 files changed, 49 insertions, 18 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index c47b33e464..6831f3b639 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,16 @@
2004-01-28 Not Zed <NotZed@Ximian.com>
+ ** See bug #53179
+
+ * mail-tools.c (mail_tool_get_local_movemail_path): Fix the
+ movemail path.
+
+ * mail-component.c (load_accounts): hack alert!
+ * mail-send-recv.c (get_receive_type): hack alert! hardcode mbox:
+ to be a movemail source.
+
+2004-01-28 Not Zed <NotZed@Ximian.com>
+
* mail-send-recv.c (setup_send_data): ref folder from
mail_component_get_folder.
diff --git a/mail/mail-component.c b/mail/mail-component.c
index a9c850ab25..2aaccfe8c8 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -192,8 +192,12 @@ load_accounts (MailComponent *component, EAccountList *accounts)
account = (EAccount *) e_iterator_get (iter);
service = account->source;
name = account->name;
-
- if (account->enabled && service->url != NULL)
+
+ /* HACK: mbox url's are handled by the local store setup above,
+ any that come through as account sources are really movemail sources! */
+ if (account->enabled
+ && service->url != NULL
+ && strncmp(service->url, "mbox:", 5) != 0)
mail_component_load_store_by_uri (component, service->url, name);
e_iterator_next (iter);
@@ -675,8 +679,8 @@ mail_component_load_store_by_uri (MailComponent *component, const char *uri, con
return NULL;
}
- if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE) ||
- (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL))
+ if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE)
+ || (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL))
return NULL;
store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 84217219fa..c85b519876 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -267,6 +267,11 @@ static send_info_t get_receive_type(const char *url)
CamelProvider *provider;
CamelException ex;
+ /* HACK: since mbox is ALSO used for native evolution trees now, we need to
+ fudge this to treat it as a special 'movemail' source */
+ if (!strncmp(url, "mbox:", 5))
+ return SEND_RECEIVE;
+
camel_exception_init(&ex);
provider = camel_session_get_provider (session, url, &ex);
camel_exception_clear(&ex);
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index ac04e63c67..0a16a27e0f 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -37,6 +37,7 @@
#include <camel/camel.h>
#include <camel/camel-vee-folder.h>
+#include <camel/camel-file-utils.h>
#include <filter/vfolder-rule.h>
#include <filter/vfolder-context.h>
@@ -97,22 +98,30 @@ mail_tool_get_trash (const gchar *url, int connect, CamelException *ex)
}
static char *
-mail_tool_get_local_movemail_path (const unsigned char *uri)
+mail_tool_get_local_movemail_path (const unsigned char *uri, CamelException *ex)
{
unsigned char *safe_uri, *c;
- char *path;
-
+ char *path, *full;
+ struct stat st;
+
safe_uri = g_strdup (uri);
for (c = safe_uri; *c; c++)
- if (strchr ("/:;=|%&#!*^()\\, ", *c) || !isprint ((int) *c))
+ if (strchr("/:;=|%&#!*^()\\, ", *c) || !isprint((int) *c))
*c = '_';
+
+ path = g_strdup_printf("%s/mail/spool", mail_component_peek_base_directory(NULL));
+ if (stat(path, &st) == -1 && camel_mkdir(path, 0777) == -1) {
+ camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create spool directory `%s': %s"),
+ path, g_strerror(errno));
+ g_free(path);
+ return NULL;
+ }
+
+ full = g_strdup_printf("%s/movemail.%s", path, safe_uri);
+ g_free(path);
+ g_free(safe_uri);
- path = g_strdup_printf ("%s/local/Inbox/movemail.%s",
- mail_component_peek_base_directory (mail_component_peek ()),
- safe_uri);
- g_free (safe_uri);
-
- return path;
+ return full;
}
char *
@@ -127,17 +136,19 @@ mail_tool_do_movemail (const char *source_url, CamelException *ex)
return NULL;
if (strcmp(uri->protocol, "mbox") != 0) {
- /* FIXME: use right text here post 1.4 */
+ /* This is really only an internal error anyway */
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
- _("Could not parse URL `%s'"),
+ _("Trying to movemail a non-mbox source `%s'"),
source_url);
camel_url_free(uri);
return NULL;
}
/* Set up our destination. */
- dest_path = mail_tool_get_local_movemail_path (source_url);
-
+ dest_path = mail_tool_get_local_movemail_path (source_url, ex);
+ if (dest_path == NULL)
+ return NULL;
+
/* Movemail from source (source_url) to dest_path */
camel_movemail (uri->path, dest_path, ex);
camel_url_free(uri);