diff options
author | Peter Williams <peterw@src.gnome.org> | 2000-08-23 04:09:11 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2000-08-23 04:09:11 +0800 |
commit | 130bb0e5710983ce14d1151f2611beaff6891379 (patch) | |
tree | b54b0a4141379ea553cdad8b7ac6d80a5fba2acb /filter/filter-driver.c | |
parent | dcc47cc15f6ff1e1cb866495625006e5481f85a6 (diff) | |
download | gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.tar.gz gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.tar.zst gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.zip |
Automatically connect services when given a valid URL (should hopefully disconnect, too); remove the old movemail folder correctly.
svn path=/trunk/; revision=4965
Diffstat (limited to 'filter/filter-driver.c')
-rw-r--r-- | filter/filter-driver.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/filter/filter-driver.c b/filter/filter-driver.c index e3e1c7df5e..5cedee6e85 100644 --- a/filter/filter-driver.c +++ b/filter/filter-driver.c @@ -48,6 +48,7 @@ typedef struct { gboolean self_destruct; gpointer unhook_func; gpointer unhook_data; + gchar *path_to_unlink; } filter_mail_input_t; /* mail-thread filter functions */ @@ -418,7 +419,8 @@ static const mail_operation_spec op_filter_mail = void filter_driver_run (FilterDriver *d, CamelFolder *source, CamelFolder *inbox, enum _filter_source_t sourcetype, - gboolean self_destruct, gpointer unhook_func, gpointer unhook_data) + gboolean self_destruct, gpointer unhook_func, gpointer unhook_data, + const char *path_to_unlink) { filter_mail_input_t *input; @@ -430,6 +432,7 @@ filter_driver_run (FilterDriver *d, CamelFolder *source, CamelFolder *inbox, input->self_destruct = self_destruct; input->unhook_func = unhook_func; input->unhook_data = unhook_data; + input->path_to_unlink = g_strdup (path_to_unlink); mail_operation_queue (&op_filter_mail, input, TRUE); } @@ -618,9 +621,25 @@ 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_sync (source, TRUE, ex); + if (inbox != source) + camel_folder_sync (inbox, FALSE, ex); camel_folder_thaw (inbox); mail_tool_camel_lock_down (); + + if (input->path_to_unlink) { + struct stat sb; + + if (stat (input->path_to_unlink, &sb) < 0) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Couldn't stat(2) movemail folder %s"), + input->path_to_unlink); + return; + } + + if (sb.st_size == 0) + unlink (input->path_to_unlink); + } } static void @@ -631,6 +650,9 @@ cleanup_filter_mail (gpointer in_data, gpointer op_data, CamelException *ex) camel_object_unref (CAMEL_OBJECT (input->source)); camel_object_unref (CAMEL_OBJECT (input->inbox)); + if (input->path_to_unlink) + g_free (input->path_to_unlink); + if (input->self_destruct) gtk_object_unref (GTK_OBJECT (input->driver)); } |