[evolution-ews] Clean up cache if out of sync when deleting messages



commit 3624bf3c8c092aa6d1a6a2aae2e42f0917e0b874
Author: Jonas Anden <jonas boot se>
Date:   Thu Jun 16 14:05:28 2011 +0200

    Clean up cache if out of sync when deleting messages
    
    If the delete fails due to the item not being found in the server,
    delete the items from the cache anyway and trigger a refresh of the
    folder information since we're definitely out of sync, and hide the
    error from the user.

 src/camel/camel-ews-folder.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index 0374acc..8f27309 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -1155,6 +1155,14 @@ ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expung
 							EWS_SEND_TO_NONE, FALSE, cancellable, &rerror);
 		camel_service_unlock (CAMEL_SERVICE (ews_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
+		if (!status && rerror->code == EWS_CONNECTION_ERROR_ITEMNOTFOUND) {
+			/* If delete failed due to the item not found, ignore the error,
+			   trigger folder info refresh and then go on to clear the
+			   cache of the deleted items anyway. */
+			g_clear_error(&rerror);
+			status = ews_refresh_info_sync (folder, EVO3(cancellable,) &rerror);
+		}
+
 		if (status) {
 			while (deleted_items) {
 				const gchar *uid = (gchar *)deleted_items->data;



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