diff --git a/ChangeLog b/ChangeLog index 258528bc3..0555f3144 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,16 @@ (-fetchFreeBusyInfosFrom:to:): add off-hours if defaults SOGoBusyOffHours is true. +2011-09-27 Wolfgang Sourdeau + + * OpenChange/MAPIStoreFolder.m + (-moveCopyMessagesWithMID:fromFolder:withMID:wantCopy:): ensure + the message URL exists in the MAPIStoreMapping, otherwise fail + with MAPISTORE_ERR_NOT_FOUND, to avoid a crash. + + * OpenChange/MAPIStoreFSMessage.m (-objectVersion): return + 0xff...fff when "version" does not exist in the object properties. + 2011-09-26 Wolfgang Sourdeau * OpenChange/MAPIStoreFolder.m diff --git a/OpenChange/MAPIStoreFSMessage.m b/OpenChange/MAPIStoreFSMessage.m index abf5ba568..4a915d926 100644 --- a/OpenChange/MAPIStoreFSMessage.m +++ b/OpenChange/MAPIStoreFSMessage.m @@ -89,7 +89,9 @@ Class NSNumberK; version = [[sogoObject properties] objectForKey: @"version"]; - return exchange_globcnt ([version unsignedLongLongValue]); + return (version + ? exchange_globcnt ([version unsignedLongLongValue]) + : 0xffffffffffffffff); } - (int) getProperty: (void **) data diff --git a/OpenChange/MAPIStoreFolder.m b/OpenChange/MAPIStoreFolder.m index 3e60e4ee4..e758d3eb6 100644 --- a/OpenChange/MAPIStoreFolder.m +++ b/OpenChange/MAPIStoreFolder.m @@ -641,6 +641,7 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe int rc = MAPISTORE_SUCCESS; NSUInteger count; NSMutableArray *oldMessageURLs; + NSString *oldMessageURL; MAPIStoreMapping *mapping; if ([sourceFolder isKindOfClass: isa] @@ -651,11 +652,17 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe mapping = [[self context] mapping]; for (count = 0; rc == MAPISTORE_SUCCESS && count < midCount; count++) { - [oldMessageURLs addObject: [mapping urlFromID: srcMids[count]]]; - rc = [self moveCopyMessageWithMID: srcMids[count] - fromFolder: sourceFolder - withMID: targetMids[count] - wantCopy: wantCopy]; + oldMessageURL = [mapping urlFromID: srcMids[count]]; + if (oldMessageURL) + { + [oldMessageURLs addObject: oldMessageURL]; + rc = [self moveCopyMessageWithMID: srcMids[count] + fromFolder: sourceFolder + withMID: targetMids[count] + wantCopy: wantCopy]; + } + else + rc = MAPISTORE_ERR_NOT_FOUND; } /* Notifications */