From 94372b5f1857b66d1ae7e14a37075122b5c8336c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 8 Apr 2013 08:25:35 -0400 Subject: e_mail_folder_uri_parse: Handle local mbox folder URIs. In Evolution 2.x, the local mail store used mbox format. Camel will not recognize the old-style "mbox:///.../local" folder URIs, since the local mail store is now Maildir format. Test for this and work around it. This should re-fix bug 638307 which was a nuisance error about failing to append to a "mbox:///.../local#Sent" folder after sending a message. --- libemail-engine/e-mail-folder-utils.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'libemail-engine') diff --git a/libemail-engine/e-mail-folder-utils.c b/libemail-engine/e-mail-folder-utils.c index 4047e0e759..deddd4ac70 100644 --- a/libemail-engine/e-mail-folder-utils.c +++ b/libemail-engine/e-mail-folder-utils.c @@ -1872,8 +1872,30 @@ e_mail_folder_uri_parse (CamelSession *session, * To determine which it is, you have to check the provider * flags for CAMEL_URL_FRAGMENT_IS_PATH. */ } else { - service = camel_session_ref_service_by_url ( - session, url, CAMEL_PROVIDER_STORE); + gboolean local_mbox_folder; + + /* In Evolution 2.x, the local mail store used mbox + * format. camel_session_ref_service_by_url() won't + * match "mbox:///.../mail/local" folder URIs, since + * the local mail store is now Maildir format. Test + * for this corner case and work around it. + * + * The folder path is kept in the fragment part of the + * URL which makes it easy to test the filesystem path. + * The suffix "evolution/mail/local" should match both + * the current XDG-compliant location and the old "dot + * folder" location (~/.evolution/mail/local). */ + local_mbox_folder = + (g_strcmp0 (url->protocol, "mbox") == 0) && + (url->path != NULL) && + g_str_has_suffix (url->path, "evolution/mail/local"); + + if (local_mbox_folder) { + service = camel_session_ref_service (session, "local"); + } else { + service = camel_session_ref_service_by_url ( + session, url, CAMEL_PROVIDER_STORE); + } if (CAMEL_IS_STORE (service)) { CamelProvider *provider; -- cgit v1.2.3