aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-tools.c
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-08-11 02:46:39 +0800
committerPeter Williams <peterw@src.gnome.org>2000-08-11 02:46:39 +0800
commit1ecabb0dc4b97d18725d4bbbeb66fb0f4465ece1 (patch)
tree0255e9355495c941ec1c95f4ec234648af0ba079 /mail/mail-tools.c
parent7df68b2c7da61c00327e54db57e38fcf60e9db2c (diff)
downloadgsoc2013-evolution-1ecabb0dc4b97d18725d4bbbeb66fb0f4465ece1.tar
gsoc2013-evolution-1ecabb0dc4b97d18725d4bbbeb66fb0f4465ece1.tar.gz
gsoc2013-evolution-1ecabb0dc4b97d18725d4bbbeb66fb0f4465ece1.tar.bz2
gsoc2013-evolution-1ecabb0dc4b97d18725d4bbbeb66fb0f4465ece1.tar.lz
gsoc2013-evolution-1ecabb0dc4b97d18725d4bbbeb66fb0f4465ece1.tar.xz
gsoc2013-evolution-1ecabb0dc4b97d18725d4bbbeb66fb0f4465ece1.tar.zst
gsoc2013-evolution-1ecabb0dc4b97d18725d4bbbeb66fb0f4465ece1.zip
Fix the infinite movemail
svn path=/trunk/; revision=4696
Diffstat (limited to 'mail/mail-tools.c')
-rw-r--r--mail/mail-tools.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 8091b55fd3..10e70a6a6f 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -123,6 +123,12 @@ mail_tool_get_local_inbox_url (void)
return g_strdup_printf ("mbox://%s/local/Inbox", evolution_dir);
}
+gchar *
+mail_tool_get_local_movemail_path (void)
+{
+ return g_strdup_printf ("%s/local/Inbox/movemail", evolution_dir);
+}
+
CamelFolder *
mail_tool_get_local_inbox (CamelException *ex)
{
@@ -158,7 +164,7 @@ mail_tool_do_movemail (const gchar *source_url, CamelException *ex)
/* Set up our destination. */
dest_url = mail_tool_get_local_inbox_url();
- dest_path = g_strdup_printf ("%s/local/Inbox/movemail", evolution_dir);
+ dest_path = mail_tool_get_local_movemail_path();
/* Create a new movemail mailbox file of 0 size */
@@ -461,6 +467,7 @@ static CamelFolder *get_folder_func (FilterDriver *d, const char *uri, void *dat
void
mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest,
+ gboolean delete_source,
gpointer hook_func, gpointer hook_data,
CamelException *ex)
{
@@ -483,6 +490,27 @@ mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest,
hook_func, hook_data);
filter_driver_run (filter, source, dest, TRUE, hook_func, hook_data);
+
+ camel_folder_sync (CAMEL_FOLDER (source), TRUE, ex);
+ camel_folder_sync (CAMEL_FOLDER (dest), TRUE, ex);
+
+ if (delete_source) {
+ gchar *path = mail_tool_get_local_movemail_path();
+ struct stat sb;
+
+ if (stat (path, &sb) < 0) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ "Couldn't stat movemail folder %s",
+ path);
+ g_free (path);
+ return;
+ }
+
+ if (sb.st_size == 0)
+ unlink (path);
+
+ g_free (path);
+ }
}
CamelFolder *