diff options
-rw-r--r-- | filter/ChangeLog | 4 | ||||
-rw-r--r-- | filter/filter-driver.c | 1 | ||||
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 2 | ||||
-rw-r--r-- | mail/mail-ops.c | 1 | ||||
-rw-r--r-- | mail/mail-tools.c | 30 | ||||
-rw-r--r-- | mail/mail-tools.h | 13 |
7 files changed, 49 insertions, 8 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index 149132854c..e2663340aa 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,7 @@ +2000-08-10 Peter Williams <peterw@helixcode.com> + + * filter-driver.c (do_filter_mail): Fix the infinite fetchmail. + 2000-08-10 Not Zed <NotZed@HelixCode.com> * filter-driver.c (filter_driver_run): Save the results of diff --git a/filter/filter-driver.c b/filter/filter-driver.c index 20950ad3eb..6269bb5bd8 100644 --- a/filter/filter-driver.c +++ b/filter/filter-driver.c @@ -604,6 +604,7 @@ do_filter_mail (gpointer in_data, gpointer op_data, CamelException *ex) close_folders (d); g_hash_table_destroy (p->folders); mail_tool_camel_lock_up (); + camel_folder_sync (p->source, TRUE, ex); camel_folder_thaw (inbox); mail_tool_camel_lock_down (); } diff --git a/mail/ChangeLog b/mail/ChangeLog index 0b40c4553f..e2d38a2a1c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2000-08-10 Peter Williams <peterw@helixcode.com> + + * mail-tools.c (mail_tool_filter_contents_into): Delete the source + folder if told to and if it's empty + (mail_tool_get_local_movemail_path): New function. + 2000-08-10 Dan Winship <danw@helixcode.com> * mail-callbacks.c (reply_to_all): Fix a bug in the async changes. diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index b12f148062..fb0a0d5c5c 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -184,7 +184,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data) ciaddr = camel_internet_address_new (); camel_internet_address_add (ciaddr, id->name, id->address); from = camel_address_encode (CAMEL_ADDRESS (ciaddr)); - camel_object_unref (ciaddr); + camel_object_unref (CAMEL_OBJECT (ciaddr)); } /* Get the message */ diff --git a/mail/mail-ops.c b/mail/mail-ops.c index d235c6b2d9..bd080d7f01 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -117,6 +117,7 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException * ex) } mail_tool_filter_contents_into (search_folder, input->destination, + TRUE, input->hook_func, input->hook_data, ex); camel_object_unref (CAMEL_OBJECT (search_folder)); 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 * diff --git a/mail/mail-tools.h b/mail/mail-tools.h index 6d189c2ea5..03b2af8a9f 100644 --- a/mail/mail-tools.h +++ b/mail/mail-tools.h @@ -36,16 +36,16 @@ CamelFolder * mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name, CamelException *ex); /* Get the url for the local inbox */ -gchar * -mail_tool_get_local_inbox_url (void); +gchar *mail_tool_get_local_inbox_url (void); + +/* Get the filename for our movemail folder */ +gchar *mail_tool_get_local_movemail_path (void); /* Get the CamelFolder for the local inbox */ -CamelFolder * -mail_tool_get_local_inbox (CamelException *ex); +CamelFolder *mail_tool_get_local_inbox (CamelException *ex); /* Get the "inbox" for a url (uses global session) */ -CamelFolder * -mail_tool_get_inbox (const gchar *url, CamelException *ex); +CamelFolder *mail_tool_get_inbox (const gchar *url, CamelException *ex); /* Does a camel_movemail into the local movemail folder * and returns the movemail folder that was created. */ @@ -81,6 +81,7 @@ mail_tool_fetch_mail_into_searchable (const char *source_url, gboolean keep_on_s /* Filter source into dest using the default filters. */ void mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest, + gboolean delete_source, gpointer hook_func, gpointer hook_data, CamelException *ex); |