diff options
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-ops.c | 40 |
2 files changed, 42 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 77c7505058..7b06fce78c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,7 +1,13 @@ +2000-09-08 Jeffrey Stedfast <fejj@helixcode.com> + + * mail-ops.c (do_fetch_mail): Updated to pass a CamelMessageInfo + to filter_driver_run + (do_filter_ondemand): Same. + 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 + return code from filter_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. diff --git a/mail/mail-ops.c b/mail/mail-ops.c index de440f801d..5c3ab58eac 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -161,14 +161,28 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) uids = camel_folder_get_uids (folder); for (i = 0; i < uids->len; i++) { CamelMimeMessage *message; + CamelMessageInfo *info; + gboolean free_info; - mail_tool_camel_lock_up (); message = camel_folder_get_message (folder, uids->pdata[i], ex); + if (camel_exception_is_set (ex)) + continue; + + if (camel_folder_has_summary_capability (folder)) { + info = (CamelMessageInfo *) camel_folder_get_message_info (folder, uids->pdata[i]); + free_info = FALSE; + } else { + info = g_new0 (CamelMessageInfo, 1); + free_info = TRUE; + } + filter_driver_run (filter, message, input->destination, - FILTER_SOURCE_INCOMING, + info, FILTER_SOURCE_INCOMING, input->hook_func, input->hook_data, TRUE, ex); - mail_tool_camel_lock_down (); + + if (free_info) + camel_message_info_free (info); /* 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 @@ -325,13 +339,29 @@ 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; + CamelMessageInfo *info; gboolean filtered; + gboolean free_info; message = camel_folder_get_message (input->source, uids->pdata[i], ex); - filtered = filter_driver_run (input->driver, message, NULL, + if (camel_exception_is_set (ex)) + continue; + + if (camel_folder_has_summary_capability (input->source)) { + info = (CamelMessageInfo *) camel_folder_get_message_info (input->source, uids->pdata[i]); + free_info = FALSE; + } else { + info = g_new0 (CamelMessageInfo, 1); + free_info = TRUE; + } + + filtered = filter_driver_run (input->driver, message, info, NULL, FILTER_SOURCE_DEMAND, NULL, NULL, TRUE, ex); - if (filtered) { + if (free_info) + camel_message_info_free (info); + + if (filtered && !camel_exception_is_set (ex)) { /* we can delete this since it's been filtered */ guint32 flags; |