Now pass the memory context when copying/moving folders.

pull/7/head
Ludovic Marcotte 2012-12-07 13:30:50 -05:00
parent e2d2212524
commit 4804337a01
5 changed files with 26 additions and 12 deletions

View File

@ -130,6 +130,7 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
withNewName: (NSString *) newFolderName withNewName: (NSString *) newFolderName
isMove: (BOOL) isMove isMove: (BOOL) isMove
isRecursive: (BOOL) isRecursive isRecursive: (BOOL) isRecursive
inMemCtx: (TALLOC_CTX *) memCtx
{ {
enum mapistore_error rc; enum mapistore_error rc;
NSString *path, *pathComponent, *targetPath, *newPath; NSString *path, *pathComponent, *targetPath, *newPath;
@ -164,7 +165,8 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
else else
rc = [super moveCopyToFolder: targetFolder withNewName: newFolderName rc = [super moveCopyToFolder: targetFolder withNewName: newFolderName
isMove: isMove isMove: isMove
isRecursive: isRecursive]; isRecursive: isRecursive
inMemCtx: memCtx];
return rc; return rc;
} }

View File

@ -129,7 +129,8 @@
- (enum mapistore_error) moveCopyToFolder: (MAPIStoreFolder *) targetFolder - (enum mapistore_error) moveCopyToFolder: (MAPIStoreFolder *) targetFolder
withNewName: (NSString *) newFolderName withNewName: (NSString *) newFolderName
isMove: (BOOL) isMove isMove: (BOOL) isMove
isRecursive: (BOOL) isRecursive; isRecursive: (BOOL) isRecursive
inMemCtx: (TALLOC_CTX *) memCtx;
- (int) getDeletedFMIDs: (struct UI8Array_r **) fmidsPtr - (int) getDeletedFMIDs: (struct UI8Array_r **) fmidsPtr
andCN: (uint64_t *) cnPtr andCN: (uint64_t *) cnPtr

View File

@ -786,6 +786,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
withNewName: (NSString *) newFolderName withNewName: (NSString *) newFolderName
isMove: (BOOL) isMove isMove: (BOOL) isMove
isRecursive: (BOOL) isRecursive isRecursive: (BOOL) isRecursive
inMemCtx: (TALLOC_CTX *) memCtx
{ {
enum mapistore_error rc; enum mapistore_error rc;
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
@ -798,9 +800,9 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
NSUInteger count, max; NSUInteger count, max;
NSString *childKey; NSString *childKey;
uint64_t fmid; uint64_t fmid;
TALLOC_CTX *memCtx; //TALLOC_CTX *memCtx;
memCtx = talloc_zero (NULL, TALLOC_CTX); //memCtx = talloc_zero (NULL, TALLOC_CTX);
/* TODO: one possible issue with this algorithm is that moved messages will /* TODO: one possible issue with this algorithm is that moved messages will
lack a version number and will all be assigned a new one, even though lack a version number and will all be assigned a new one, even though
@ -878,7 +880,9 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
subFolder = [self lookupFolder: childKey]; subFolder = [self lookupFolder: childKey];
[subFolder moveCopyToFolder: newFolder withNewName: nil [subFolder moveCopyToFolder: newFolder withNewName: nil
isMove: isMove isMove: isMove
isRecursive: isRecursive]; isRecursive: isRecursive
inMemCtx: memCtx];
} }
[pool release]; [pool release];
} }
@ -898,7 +902,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
else else
rc = MAPISTORE_ERR_DENIED; rc = MAPISTORE_ERR_DENIED;
talloc_free (memCtx); //talloc_free (memCtx);
return rc; return rc;
} }

View File

@ -1055,6 +1055,7 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
withNewName: (NSString *) newFolderName withNewName: (NSString *) newFolderName
isMove: (BOOL) isMove isMove: (BOOL) isMove
isRecursive: (BOOL) isRecursive isRecursive: (BOOL) isRecursive
inMemCtx: (TALLOC_CTX *) memCtx
{ {
enum mapistore_error rc; enum mapistore_error rc;
NSURL *folderURL, *newFolderURL; NSURL *folderURL, *newFolderURL;
@ -1150,7 +1151,8 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
moveCopyToFolder: newFolder moveCopyToFolder: newFolder
withNewName: nil withNewName: nil
isMove: NO isMove: NO
isRecursive: YES]; isRecursive: YES
inMemCtx: memCtx];
} }
} }
} }
@ -1163,7 +1165,8 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
else else
rc = [super moveCopyToFolder: targetFolder withNewName: newFolderName rc = [super moveCopyToFolder: targetFolder withNewName: newFolderName
isMove: isMove isMove: isMove
isRecursive: isRecursive]; isRecursive: isRecursive
inMemCtx: memCtx];
return rc; return rc;
} }

View File

@ -611,7 +611,7 @@ sogo_folder_move_copy_messages(void *folder_object,
static enum mapistore_error static enum mapistore_error
sogo_folder_move_folder(void *folder_object, void *target_folder_object, sogo_folder_move_folder(void *folder_object, void *target_folder_object,
const char *new_folder_name) TALLOC_CTX *mem_ctx, const char *new_folder_name)
{ {
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
MAPIStoreFolder *moveFolder, *targetFolder; MAPIStoreFolder *moveFolder, *targetFolder;
@ -643,7 +643,9 @@ sogo_folder_move_folder(void *folder_object, void *target_folder_object,
rc = [moveFolder moveCopyToFolder: targetFolder rc = [moveFolder moveCopyToFolder: targetFolder
withNewName: newFolderName withNewName: newFolderName
isMove: YES isMove: YES
isRecursive: YES]; isRecursive: YES
inMemCtx: mem_ctx];
[pool release]; [pool release];
GSUnregisterCurrentThread (); GSUnregisterCurrentThread ();
} }
@ -656,7 +658,7 @@ sogo_folder_move_folder(void *folder_object, void *target_folder_object,
} }
static enum mapistore_error static enum mapistore_error
sogo_folder_copy_folder(void *folder_object, void *target_folder_object, sogo_folder_copy_folder(void *folder_object, void *target_folder_object, TALLOC_CTX *mem_ctx,
bool recursive, const char *new_folder_name) bool recursive, const char *new_folder_name)
{ {
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
@ -683,7 +685,9 @@ sogo_folder_copy_folder(void *folder_object, void *target_folder_object,
rc = [copyFolder moveCopyToFolder: targetFolder rc = [copyFolder moveCopyToFolder: targetFolder
withNewName: newFolderName withNewName: newFolderName
isMove: NO isMove: NO
isRecursive: recursive]; isRecursive: recursive
inMemCtx: mem_ctx];
[pool release]; [pool release];
GSUnregisterCurrentThread (); GSUnregisterCurrentThread ();
} }