From 6c710bac21f455cabfbac31fbf97f0d12ca1a4b0 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 5 Apr 2011 15:25:57 +0000 Subject: [PATCH] Monotone-Parent: 42caf93c5de027c15e42a14d1ebfa2b4b02a8630 Monotone-Revision: 981b43182d68b94d0695cb2026f2ee62b3ee256a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-04-05T15:25:57 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 +++++ OpenChange/MAPIStoreContext.m | 52 +++++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index eaff1bb17..17a204199 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-05 Wolfgang Sourdeau + + * OpenChange/MAPIStoreContext.m (_tableForFID:andTableType:): make + use of lookupFolder: to retrieve the right folder based on the FID. + (-setPropertiesWithFMID:ofTableType:inRow:): silently discard by + log the settings of properties on folders. + 2011-04-04 Wolfgang Sourdeau * UI/Scheduler/UIxCalListingActions.m diff --git a/OpenChange/MAPIStoreContext.m b/OpenChange/MAPIStoreContext.m index 1cf211aad..8f6ebe824 100644 --- a/OpenChange/MAPIStoreContext.m +++ b/OpenChange/MAPIStoreContext.m @@ -312,7 +312,7 @@ _prepareContextClass (struct mapistore_context *newMemCtx, folderKey = [parentFolder createFolder: aRow]; if (folderKey) { - folderURL = [NSString stringWithFormat: @"%@%@", + folderURL = [NSString stringWithFormat: @"%@%@/", parentFolderURL, folderKey]; [mapping registerURL: folderURL withID: fid]; rc = MAPISTORE_SUCCESS; @@ -387,21 +387,39 @@ _prepareContextClass (struct mapistore_context *newMemCtx, { MAPIStoreFolder *folder; MAPIStoreTable *table; + NSString *folderURL; /* TODO: should handle folder hierarchies */ - folder = baseFolder; - - if (tableType == MAPISTORE_MESSAGE_TABLE) - table = [folder messageTable]; - else if (tableType == MAPISTORE_FAI_TABLE) - table = [folder faiMessageTable]; - else if (tableType == MAPISTORE_FOLDER_TABLE) - table = [folder folderTable]; + folderURL = [mapping urlFromID: fid]; + if (folderURL) + { + folder = [self lookupFolder: folderURL]; + if (folder) + { + if (tableType == MAPISTORE_MESSAGE_TABLE) + table = [folder messageTable]; + else if (tableType == MAPISTORE_FAI_TABLE) + table = [folder faiMessageTable]; + else if (tableType == MAPISTORE_FOLDER_TABLE) + table = [folder folderTable]; + else + { + table = nil; + [NSException raise: @"MAPIStoreIOException" + format: @"unsupported table type: %d", tableType]; + } + } + else + { + table = nil; + [self errorWithFormat: @"folder with url '%@' not found", folderURL]; + } + } else { table = nil; - [NSException raise: @"MAPIStoreIOException" - format: @"unsupported table type: %d", tableType]; + [self errorWithFormat: @"folder with fid %Lu not found", + (unsigned long long) fid]; } return table; @@ -511,7 +529,7 @@ _prepareContextClass (struct mapistore_context *newMemCtx, { NSString *folderURL; MAPIStoreTable *table; - MAPIStoreMessage *message; + MAPIStoreObject *object; const char *propName; int rc; @@ -531,10 +549,10 @@ _prepareContextClass (struct mapistore_context *newMemCtx, { table = [self _tableForFID: fid andTableType: tableType]; *data = NULL; - message = [table childAtRowID: pos forQueryType: queryType]; - if (message) + object = [table childAtRowID: pos forQueryType: queryType]; + if (object) { - rc = [message getProperty: data withTag: propTag]; + rc = [object getProperty: data withTag: propTag]; if (rc == MAPISTORE_ERR_NOT_FOUND) rc = MAPI_E_NOT_FOUND; else if (rc == MAPISTORE_ERR_NO_MEMORY) @@ -946,6 +964,10 @@ _prepareContextClass (struct mapistore_context *newMemCtx, } break; case MAPISTORE_FOLDER: + [self logWithFormat: @"%s: ignored setting of props on folders", + __FUNCTION__]; + rc = MAPISTORE_SUCCESS; + break; default: [self errorWithFormat: @"%s: value of tableType not handled: %d", __FUNCTION__, tableType];