[evolution-data-server] IMAPX: Avoid duplicating messages in real Junk or Trash.



commit f48d53cb5e366de2870911a2c238e833f3f0a120
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Dec 24 07:37:42 2012 -0500

    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 files 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: ",



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