aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-ops.c23
2 files changed, 24 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 05ac3f7660..77c7505058 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2000-09-07 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * mail-ops.c (do_filter_ondemand): Updated to check the boolean
+ return code from fulter_driver_run to find out whether or not the
+ message was filtered so that it can decide whether or not to
+ delete the message from the source folder or not.
+
2000-09-07 Jesse Pavel <jpavel@helixcode.com>
* mail-format.c (mail_generate_reply) Changed the behavior of
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 39127cae71..de440f801d 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -164,13 +164,15 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex)
mail_tool_camel_lock_up ();
message = camel_folder_get_message (folder, uids->pdata[i], ex);
- fprintf (stderr, "about to run the filter\n");
filter_driver_run (filter, message, input->destination,
FILTER_SOURCE_INCOMING,
input->hook_func, input->hook_data,
TRUE, ex);
mail_tool_camel_lock_down ();
+ /* we don't care if it was filtered or not here because no matter
+ what it's been copied to at least 1 folder - even if it's just
+ the default */
if (!input->keep_on_server && !camel_exception_is_set (ex)) {
guint32 flags;
@@ -323,18 +325,27 @@ do_filter_ondemand (gpointer in_data, gpointer op_data, CamelException *ex)
uids = camel_folder_get_uids (input->source);
for (i = 0; i < uids->len; i++) {
CamelMimeMessage *message;
+ gboolean filtered;
message = camel_folder_get_message (input->source, uids->pdata[i], ex);
- filter_driver_run (input->driver, message, input->destination,
- FILTER_SOURCE_DEMAND, NULL, NULL, TRUE, ex);
+ filtered = filter_driver_run (input->driver, message, NULL,
+ FILTER_SOURCE_DEMAND, NULL, NULL, TRUE, ex);
- /* FIXME: should we delete the message from the source mailbox? */
+ if (filtered) {
+ /* we can delete this since it's been filtered */
+ guint32 flags;
+
+ flags = camel_folder_get_message_flags (input->source, uids->pdata[i]);
+ camel_folder_set_message_flags (input->source, uids->pdata[i],
+ CAMEL_MESSAGE_DELETED,
+ ~flags);
+ }
camel_object_unref (CAMEL_OBJECT (message));
- g_free (uids->pdata[i]);
}
- g_ptr_array_free (uids, TRUE);
+ camel_folder_sync (input->source, TRUE, ex);
+ camel_folder_free_uids (input->source, uids);
data->empty = FALSE;
}