[evolution-ews] Bug #676081 - Deleted message not deleted from server (network issue)



commit a023fc743f064a5ab4f5fb3beac2b9f3194cd14f
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jun 6 14:58:32 2012 +0200

    Bug #676081 - Deleted message not deleted from server (network issue)

 src/camel/camel-ews-folder.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index fdee495..7d0e1fd 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -834,9 +834,14 @@ ews_synchronize_sync (CamelFolder *folder,
 	if (!camel_ews_store_connected (ews_store, error))
 		return FALSE;
 
-	uids = camel_folder_summary_get_changed (folder->summary);
-	if (!uids->len) {
-		camel_folder_free_uids (folder, uids);
+	if (camel_folder_summary_get_deleted_count (folder->summary) > 0) {
+		camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
+		uids = camel_folder_summary_get_array (folder->summary);
+	} else {
+		uids = camel_folder_summary_get_changed (folder->summary);
+	}
+	if (!uids || !uids->len) {
+		camel_folder_summary_free_array (uids);
 		return TRUE;
 	}
 
@@ -859,10 +864,12 @@ ews_synchronize_sync (CamelFolder *folder,
 		} else if (flags_changed & CAMEL_MESSAGE_DELETED) {
 			deleted_uids = g_slist_prepend (deleted_uids, (gpointer) camel_pstring_strdup (uids->pdata[i]));
 			camel_message_info_free (mi);
-		} else {
+		} else if (mi->info.dirty || (mi->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0) {
 			/* OK, the change must have been the labels */
 			mi_list = g_slist_append (mi_list, mi);
 			mi_list_len++;
+		} else {
+			camel_message_info_free (mi);
 		}
 
 		if (mi_list_len == EWS_MAX_FETCH_COUNT) {
@@ -879,7 +886,7 @@ ews_synchronize_sync (CamelFolder *folder,
 		success = ews_delete_messages (folder, deleted_uids, ews_folder_is_trash (folder), cancellable, error);
 
 	camel_folder_summary_save_to_db (folder->summary, NULL);
-	camel_folder_free_uids (folder, uids);
+	camel_folder_summary_free_array (uids);
 
 	return success;
 }



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