Commit eac4adfb authored by Milan Crha's avatar Milan Crha Committed by Rodrigo Moya
Browse files

Bug #643218 - Local delivery doesn't deliver after maildir migration

parent c1b409dd
......@@ -30,6 +30,7 @@
#include "mail/e-mail-local.h"
#include "mail/em-folder-tree-model.h"
#include "mail/em-utils.h"
#include "mail/mail-folder-cache.h"
#include "mail/mail-mt.h"
#include "mail/mail-ops.h"
......@@ -251,6 +252,10 @@ mail_store_load_accounts (EMailSession *session,
if (uri == NULL || *uri == '\0')
continue;
/* do not add local-delivery files into the tree those are server specifically */
if (em_utils_is_local_delivery_mbox_file (uri))
continue;
e_mail_store_add_by_uri (session, uri, display_name);
}
......
......@@ -2353,3 +2353,27 @@ emu_restore_folder_tree_state (EMFolderTree *folder_tree)
g_key_file_free (key_file);
}
/* checks whether uri points to a local mbox file and returns TRUE if yes. */
gboolean
em_utils_is_local_delivery_mbox_file (const gchar *uri)
{
g_return_val_if_fail (uri != NULL, FALSE);
if (g_str_has_prefix (uri, "mbox:///")) {
CamelURL *curl;
curl = camel_url_new (uri, NULL);
if (curl) {
if (curl->path
&& g_file_test (curl->path, G_FILE_TEST_EXISTS)
&& !g_file_test (curl->path, G_FILE_TEST_IS_DIR)) {
camel_url_free (curl);
return TRUE;
}
camel_url_free (curl);
}
}
return FALSE;
}
......@@ -102,6 +102,8 @@ void emu_free_mail_cache (void);
void emu_restore_folder_tree_state (EMFolderTree *folder_tree);
gboolean em_utils_is_local_delivery_mbox_file (const gchar *uri);
G_END_DECLS
#endif /* __EM_UTILS_H__ */
......@@ -241,7 +241,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
/* FIXME: this should support keep_on_server too, which would then perform a spool
access thingy, right? problem is matching raw messages to uid's etc. */
if (!strncmp (m->source_uri, "maildir:", 5)) {
if (em_utils_is_local_delivery_mbox_file (m->source_uri)) {
gchar *path = mail_tool_do_movemail (m->source_uri, error);
if (path && (!error || !*error)) {
......
......@@ -39,6 +39,7 @@
#include "e-mail-session.h"
#include "em-event.h"
#include "em-filter-rule.h"
#include "em-utils.h"
#include "mail-folder-cache.h"
#include "mail-mt.h"
#include "mail-ops.h"
......@@ -382,9 +383,9 @@ get_receive_type (const gchar *url)
{
CamelProvider *provider;
/* 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, "maildir:", 8))
/* mbox pointing to a file is a 'Local delivery' source
which requires special processing */
if (em_utils_is_local_delivery_mbox_file (url))
return SEND_RECEIVE;
provider = camel_provider_get (url, NULL);
......
......@@ -94,7 +94,7 @@ mail_tool_do_movemail (const gchar *source_url, GError **error)
if (uri == NULL)
return NULL;
if (strcmp(uri->protocol, "maildir") != 0) {
if (strcmp (uri->protocol, "mbox") != 0) {
/* This is really only an internal error anyway */
g_set_error (
error, CAMEL_SERVICE_ERROR,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment