[evolution-data-server] Copy messages within mail filters immediately



commit 63741937d0fb39893deeaa5d23dbbf8c413ec40a
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 27 07:41:31 2018 +0100

    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

 src/camel/camel-filter-driver.c | 53 ++++++++++++++++-------------------------
 1 file 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 (


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]