Fix the infinite movemail

svn path=/trunk/; revision=4696
This commit is contained in:
Peter Williams
2000-08-10 18:46:39 +00:00
parent 7df68b2c7d
commit 1ecabb0dc4
7 changed files with 49 additions and 8 deletions

View File

@ -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

View File

@ -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 ();
}

View File

@ -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.

View File

@ -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 */

View File

@ -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));

View File

@ -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 *

View File

@ -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);