summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2018-11-27 07:41:31 +0100
committerMilan Crha <mcrha@redhat.com>2018-11-27 07:41:31 +0100
commit63741937d0fb39893deeaa5d23dbbf8c413ec40a (patch)
treea7be9c33e48c74163f478057bb5cebed94acc633
parent702cfa121787ca50b4213c249c2c23a2e0edd7d6 (diff)
downloadevolution-data-server-63741937d0fb39893deeaa5d23dbbf8c413ec40a.tar.gz
Copy messages within mail filters immediately
When a filter rule contains action to copy message, this copy cannot be batched as message move, because the copy doesn't stop further processing, thus the to-be-copied message can be further modified or even removed, thus the copy would not be correct. This had been reported downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1650665
-rw-r--r--src/camel/camel-filter-driver.c53
1 files changed, 21 insertions, 32 deletions
diff --git a/src/camel/camel-filter-driver.c b/src/camel/camel-filter-driver.c
index 423ae8525..fcc4a9692 100644
--- a/src/camel/camel-filter-driver.c
+++ b/src/camel/camel-filter-driver.c
@@ -759,28 +759,21 @@ do_copy (struct _CamelSExp *f,
if (outbox == driver->priv->source)
break;
- if (!driver->priv->modified &&
- driver->priv->uid != NULL &&
- driver->priv->source != NULL &&
- camel_folder_has_summary_capability (driver->priv->source)) {
- filter_driver_add_to_transfers (driver, outbox, driver->priv->uid, FALSE);
- } else {
- if (driver->priv->message == NULL)
- /* FIXME Pass a GCancellable */
- driver->priv->message = camel_folder_get_message_sync (
- driver->priv->source,
- driver->priv->uid, NULL,
- &driver->priv->error);
-
- if (!driver->priv->message)
- continue;
-
+ if (driver->priv->message == NULL)
/* FIXME Pass a GCancellable */
- camel_folder_append_message_sync (
- outbox, driver->priv->message,
- driver->priv->info, NULL, NULL,
+ driver->priv->message = camel_folder_get_message_sync (
+ driver->priv->source,
+ driver->priv->uid, NULL,
&driver->priv->error);
- }
+
+ if (!driver->priv->message)
+ continue;
+
+ /* FIXME Pass a GCancellable */
+ camel_folder_append_message_sync (
+ outbox, driver->priv->message,
+ driver->priv->info, NULL, NULL,
+ &driver->priv->error);
if (driver->priv->error == NULL)
driver->priv->copied = TRUE;
@@ -2120,18 +2113,14 @@ filter_driver_filter_message_internal (CamelFilterDriver *driver,
"Copy to default folder");
if (!driver->priv->modified && driver->priv->uid && driver->priv->source && camel_folder_has_summary_capability (driver->priv->source)) {
- if (can_process_transfers) {
- GPtrArray *uids;
-
- uids = g_ptr_array_new ();
- g_ptr_array_add (uids, (gchar *) driver->priv->uid);
- camel_folder_transfer_messages_to_sync (
- driver->priv->source, uids, driver->priv->defaultfolder,
- FALSE, NULL, cancellable, &driver->priv->error);
- g_ptr_array_free (uids, TRUE);
- } else {
- filter_driver_add_to_transfers (driver, driver->priv->defaultfolder, driver->priv->uid, FALSE);
- }
+ GPtrArray *uids;
+
+ uids = g_ptr_array_new ();
+ g_ptr_array_add (uids, (gchar *) driver->priv->uid);
+ camel_folder_transfer_messages_to_sync (
+ driver->priv->source, uids, driver->priv->defaultfolder,
+ FALSE, NULL, cancellable, &driver->priv->error);
+ g_ptr_array_free (uids, TRUE);
} else {
if (driver->priv->message == NULL) {
driver->priv->message = camel_folder_get_message_sync (