diff options
author | Milan Crha <mcrha@redhat.com> | 2011-03-03 21:11:41 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:41 +0800 |
commit | eac4adfbf61b7f090db0713dbdaa5f4dd081e751 (patch) | |
tree | 109c0ca0d10d60842c2edee9be38579804c0feb8 /mail | |
parent | c1b409dd42acae66ad166b68e3a7c987a1a6ce46 (diff) | |
download | gsoc2013-evolution-eac4adfbf61b7f090db0713dbdaa5f4dd081e751.tar gsoc2013-evolution-eac4adfbf61b7f090db0713dbdaa5f4dd081e751.tar.gz gsoc2013-evolution-eac4adfbf61b7f090db0713dbdaa5f4dd081e751.tar.bz2 gsoc2013-evolution-eac4adfbf61b7f090db0713dbdaa5f4dd081e751.tar.lz gsoc2013-evolution-eac4adfbf61b7f090db0713dbdaa5f4dd081e751.tar.xz gsoc2013-evolution-eac4adfbf61b7f090db0713dbdaa5f4dd081e751.tar.zst gsoc2013-evolution-eac4adfbf61b7f090db0713dbdaa5f4dd081e751.zip |
Bug #643218 - Local delivery doesn't deliver after maildir migration
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-store.c | 5 | ||||
-rw-r--r-- | mail/em-utils.c | 24 | ||||
-rw-r--r-- | mail/em-utils.h | 2 | ||||
-rw-r--r-- | mail/mail-ops.c | 2 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 7 | ||||
-rw-r--r-- | mail/mail-tools.c | 2 |
6 files changed, 37 insertions, 5 deletions
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index 9dfaab693b..e5607ef1a3 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -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); } diff --git a/mail/em-utils.c b/mail/em-utils.c index 2fdee28270..09692f0b1b 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -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; +} diff --git a/mail/em-utils.h b/mail/em-utils.h index 2b45b37037..73916b1c19 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -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__ */ diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 920b8bca73..79fce90458 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -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)) { diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 3ca7b23d58..e548d8b596 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -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); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 4bb006d705..1e1680be86 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -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, |