From f48d53cb5e366de2870911a2c238e833f3f0a120 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 24 Dec 2012 07:37:42 -0500 Subject: [PATCH] IMAPX: Avoid duplicating messages in real Junk or Trash. This is more a problem with Junk, but fixing both to keep the logic consistent. When synchronizing a real Junk folder, we were copying all messages marked as "junk" from Junk to Junk -- duplicating them each time. After running for a couple days I caught my Junk folder with thousands of duplicate messages. --- camel/camel-imapx-folder.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/camel/camel-imapx-folder.c b/camel/camel-imapx-folder.c index 8a52bb8..4b8cafb 100644 --- a/camel/camel-imapx-folder.c +++ b/camel/camel-imapx-folder.c @@ -809,17 +809,19 @@ imapx_move_to_real_junk (CamelIMAPXServer *server, _("No destination folder specified")); } - if (destination != NULL) { + /* Avoid duplicating messages in the Junk folder. */ + if (destination == folder) { + success = TRUE; + } else if (destination != NULL) { success = camel_imapx_server_copy_message ( server, folder, destination, uids_to_copy, TRUE, cancellable, error); + *out_need_to_expunge = success; } else { success = FALSE; } - *out_need_to_expunge = success; - if (!success) { g_prefix_error ( error, "%s: ", @@ -880,17 +882,19 @@ imapx_move_to_real_trash (CamelIMAPXServer *server, _("No destination folder specified")); } - if (destination != NULL) { + /* Avoid duplicating messages in the Trash folder. */ + if (destination == folder) { + success = TRUE; + } else if (destination != NULL) { success = camel_imapx_server_copy_message ( server, folder, destination, uids_to_copy, TRUE, cancellable, error); + *out_need_to_expunge = success; } else { success = FALSE; } - *out_need_to_expunge = success; - if (!success) { g_prefix_error ( error, "%s: ", -- 2.7.4