[evolution] Bug 795977 - AutoArchive archives Junk and Deleted messages too



commit 2d531753b8d572f4c5a358dae6c3f8935ce7433f
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 14 11:51:13 2018 +0200

    Bug 795977 - AutoArchive archives Junk and Deleted messages too

 src/mail/em-utils.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/mail/em-utils.c b/src/mail/em-utils.c
index 0f604bd..fd39154 100644
--- a/src/mail/em-utils.c
+++ b/src/mail/em-utils.c
@@ -1803,12 +1803,16 @@ em_utils_process_autoarchive_sync (EMailBackend *mail_backend,
 
        g_date_time_unref (now_time);
 
-       search_sexp = g_strdup_printf ("(match-all (< (get-sent-date) %" G_GINT64_FORMAT "))", 
g_date_time_to_unix (use_time));
+       search_sexp = g_strdup_printf ("(match-all (and "
+               "(not (system-flag \"junk\")) "
+               "(not (system-flag \"deleted\")) "
+               "(< (get-sent-date) %" G_GINT64_FORMAT ")"
+               "))", g_date_time_to_unix (use_time));
        uids = camel_folder_search_by_expression (folder, search_sexp, cancellable, error);
 
        if (!uids) {
                success = FALSE;
-       } else {
+       } else if (uids->len > 0) {
                gint ii;
 
                if (aa_config == E_AUTO_ARCHIVE_CONFIG_MOVE_TO_ARCHIVE ||
@@ -1863,9 +1867,10 @@ em_utils_process_autoarchive_sync (EMailBackend *mail_backend,
 
                        camel_folder_thaw (folder);
                }
+       }
 
+       if (uids)
                camel_folder_search_free (folder, uids);
-       }
 
        g_free (search_sexp);
        g_free (aa_custom_target_folder_uri);


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