From 57d591c427b2d7897bcd57717545d6aea2084381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Wed, 28 Jan 2015 11:26:56 +0100 Subject: [PATCH] oc: Set right container in dbFolder when moving a folder The path attribute from SOGoCacheGCSFolder is properly updated in the database but not when returning from path message as the container is the old one. --- OpenChange/MAPIStoreDBFolder.m | 3 ++- OpenChange/MAPIStoreMailFolder.m | 3 ++- SoObjects/SOGo/SOGoCacheGCSFolder.h | 2 ++ SoObjects/SOGo/SOGoCacheGCSFolder.m | 8 ++++++++ SoObjects/SOGo/SOGoObject.h | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenChange/MAPIStoreDBFolder.m b/OpenChange/MAPIStoreDBFolder.m index ec7207062..798af041b 100644 --- a/OpenChange/MAPIStoreDBFolder.m +++ b/OpenChange/MAPIStoreDBFolder.m @@ -152,7 +152,8 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact"; targetPath = [[targetFolder sogoObject] path]; newPath = [NSString stringWithFormat: @"%@/%@", targetPath, pathComponent]; - [dbFolder changePathTo: newPath]; + [dbFolder changePathTo: newPath + intoNewContainer: [targetFolder dbFolder]]; mapping = [self mapping]; newURL = [NSString stringWithFormat: @"%@%@/", diff --git a/OpenChange/MAPIStoreMailFolder.m b/OpenChange/MAPIStoreMailFolder.m index b8fae1e71..69f235783 100644 --- a/OpenChange/MAPIStoreMailFolder.m +++ b/OpenChange/MAPIStoreMailFolder.m @@ -1286,7 +1286,8 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) [dbFolder changePathTo: [NSString stringWithFormat: @"%@/folder%@", parentDBFolderPath, - newFolderDBName]]; + newFolderDBName] + intoNewContainer: [targetFolder dbFolder]]; } } else diff --git a/SoObjects/SOGo/SOGoCacheGCSFolder.h b/SoObjects/SOGo/SOGoCacheGCSFolder.h index 1b63ae683..3495dc0d6 100644 --- a/SoObjects/SOGo/SOGoCacheGCSFolder.h +++ b/SoObjects/SOGo/SOGoCacheGCSFolder.h @@ -49,6 +49,8 @@ andSortOrderings: (NSArray *) sortOrderings; - (void) changePathTo: (NSString *) newPath; +- (void) changePathTo: (NSString *) newPath + intoNewContainer: (id) newContainer; @end diff --git a/SoObjects/SOGo/SOGoCacheGCSFolder.m b/SoObjects/SOGo/SOGoCacheGCSFolder.m index f8d25d381..b29287fcb 100644 --- a/SoObjects/SOGo/SOGoCacheGCSFolder.m +++ b/SoObjects/SOGo/SOGoCacheGCSFolder.m @@ -308,6 +308,14 @@ Class SOGoCacheGCSObjectK = Nil; [super changePathTo: newPath]; } +- (void) changePathTo: (NSString *) newPath intoNewContainer: (id) newContainer +{ + [self changePathTo: newPath]; + container = newContainer; + if ([self doesRetainContainer]) + [container retain]; +} + // - (NSArray *) toOneRelationshipKeysMatchingQualifier: (EOQualifier *) qualifier // andSortOrderings: (NSArray *) sortOrderings // { diff --git a/SoObjects/SOGo/SOGoObject.h b/SoObjects/SOGo/SOGoObject.h index 114b0c55d..dafd5f06e 100644 --- a/SoObjects/SOGo/SOGoObject.h +++ b/SoObjects/SOGo/SOGoObject.h @@ -82,6 +82,8 @@ - (BOOL) isInPublicZone; +- (BOOL) doesRetainContainer; + /* accessors */ - (void) setContext: (WOContext *) newContext;