aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-04-08 20:25:35 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-04-08 20:47:06 +0800
commit94372b5f1857b66d1ae7e14a37075122b5c8336c (patch)
treea84a72d2c87279775394d111c78955c02bab1d16 /libemail-engine
parentfa875d8565824e3a6c2cdeeb9b2e4e95009c2723 (diff)
downloadgsoc2013-evolution-94372b5f1857b66d1ae7e14a37075122b5c8336c.tar.gz
gsoc2013-evolution-94372b5f1857b66d1ae7e14a37075122b5c8336c.tar.zst
gsoc2013-evolution-94372b5f1857b66d1ae7e14a37075122b5c8336c.zip
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.
Diffstat (limited to 'libemail-engine')
-rw-r--r--libemail-engine/e-mail-folder-utils.c26
1 files changed, 24 insertions, 2 deletions
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;