aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine/e-mail-folder-utils.c
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 21:15:42 +0800
commitac480dcea5e584a54adf4c5a6b832e49c70f7fe7 (patch)
treef93a37efaff440651b67004fce67ab2dea02d998 /libemail-engine/e-mail-folder-utils.c
parent847d77cf5737aa544901e4862604065c4d0694c6 (diff)
downloadgsoc2013-evolution-ac480dcea5e584a54adf4c5a6b832e49c70f7fe7.tar
gsoc2013-evolution-ac480dcea5e584a54adf4c5a6b832e49c70f7fe7.tar.gz
gsoc2013-evolution-ac480dcea5e584a54adf4c5a6b832e49c70f7fe7.tar.bz2
gsoc2013-evolution-ac480dcea5e584a54adf4c5a6b832e49c70f7fe7.tar.lz
gsoc2013-evolution-ac480dcea5e584a54adf4c5a6b832e49c70f7fe7.tar.xz
gsoc2013-evolution-ac480dcea5e584a54adf4c5a6b832e49c70f7fe7.tar.zst
gsoc2013-evolution-ac480dcea5e584a54adf4c5a6b832e49c70f7fe7.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. (cherry picked from commit 94372b5f1857b66d1ae7e14a37075122b5c8336c)
Diffstat (limited to 'libemail-engine/e-mail-folder-utils.c')
-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 bd45f35702..bbc1bdc33f 100644
--- a/libemail-engine/e-mail-folder-utils.c
+++ b/libemail-engine/e-mail-folder-utils.c
@@ -1873,8 +1873,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;