From 3053c319827b02d8f6079f68a64b9a018ce41fe5 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 1 Jun 2011 23:13:57 +0200 Subject: Bug #649757 - 'Local delivery' accounts stopped working --- mail/mail-ops.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'mail') diff --git a/mail/mail-ops.c b/mail/mail-ops.c index e52996c36e..85805ffa5c 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -211,7 +211,8 @@ fetch_mail_exec (struct _fetch_mail_msg *m, GError **error) { struct _filter_mail_msg *fm = (struct _filter_mail_msg *) m; - CamelFolder *folder; + CamelFolder *folder = NULL; + CamelURL *url; const gchar *uid; gint i; @@ -221,11 +222,36 @@ fetch_mail_exec (struct _fetch_mail_msg *m, goto fail; g_object_ref (fm->destination); - uid = camel_service_get_uid (CAMEL_SERVICE (m->store)); + url = camel_service_get_camel_url (CAMEL_SERVICE (m->store)); + if (em_utils_is_local_delivery_mbox_file (url)) { + gchar *path; + gchar *url_string; + + path = mail_tool_do_movemail (m->store, error); + url_string = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); - folder = fm->source_folder = - e_mail_session_get_inbox_sync ( - fm->session, uid, cancellable, error); + if (path && (!error || !*error)) { + camel_folder_freeze (fm->destination); + camel_filter_driver_set_default_folder ( + fm->driver, fm->destination); + camel_filter_driver_filter_mbox ( + fm->driver, path, url_string, + cancellable, error); + camel_folder_thaw (fm->destination); + + if (!error || !*error) + g_unlink (path); + } + + g_free (path); + g_free (url_string); + } else { + uid = camel_service_get_uid (CAMEL_SERVICE (m->store)); + + folder = fm->source_folder = + e_mail_session_get_inbox_sync ( + fm->session, uid, cancellable, error); + } if (folder != NULL) { /* This handles 'keep on server' stuff, if we have any new -- cgit v1.2.3