aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-09-08 07:12:13 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-09-08 07:12:13 +0800
commit28d0e6247e9570a092f44a3b443c7a672c8cbe2a (patch)
tree193c74087b447307d70c6f0a56158fa725276163 /mail/mail-ops.c
parentd7077dc7742bb9ed615e5ccb426c938be2adb824 (diff)
downloadgsoc2013-evolution-28d0e6247e9570a092f44a3b443c7a672c8cbe2a.tar.gz
gsoc2013-evolution-28d0e6247e9570a092f44a3b443c7a672c8cbe2a.tar.zst
gsoc2013-evolution-28d0e6247e9570a092f44a3b443c7a672c8cbe2a.zip
Updated to check the boolean return code from fulter_driver_run to find
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. svn path=/trunk/; revision=5250
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c23
1 files changed, 17 insertions, 6 deletions
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;
}