From 0133bb3b6bf13c81350b791be57c01d83356cba7 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 10 Jun 2014 13:07:14 -0400 Subject: [PATCH] Correctly update the cache on folder update/delete ops. --- ActiveSync/SOGoActiveSyncDispatcher.m | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 13c0617de..6f115aa2d 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -415,10 +415,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if (!error) { + NSString *syncKey, *key; + SOGoCacheGCSObject *o; NSMutableString *s; - NSString *syncKey; NSData *d; - + + // + // We mark the cache object as deleted + // + key = [NSString stringWithFormat: @"%@+%@", [context objectForKey: @"DeviceId"], [folderToDelete nameInContainer]]; + o = [SOGoCacheGCSObject objectWithName: key inContainer: nil]; + [o setTableUrl: [self folderTableURL]]; + [o reloadIfNeeded]; + [o delete]; + // // We update the FolderSync's synckey // @@ -490,10 +500,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Handle new name exist if (!error) { + NSString *syncKey, *key; + SOGoCacheGCSObject *o; NSMutableString *s; - NSString *syncKey; NSData *d; + // + // We update our cache + // + key = [NSString stringWithFormat: @"%@+folder%@", [context objectForKey: @"DeviceId"], serverId]; + o = [SOGoCacheGCSObject objectWithName: key inContainer: nil]; + [o setTableUrl: [self folderTableURL]]; + [o reloadIfNeeded]; + + key = [NSString stringWithFormat: @"%@+%@", [context objectForKey: @"DeviceId"], [folderToUpdate nameInContainer]]; + [o changePathTo: key]; + // // We update the FolderSync's synckey //