ensureIDsForChildKeys: new helper method that ensure that the child keys have a corresponding fmid and register them with -[MAPIStoreMapping registerURLs:withIDs:] if needed

This commit is contained in:
Wolfgang Sourdeau
2012-10-12 23:28:47 -04:00
parent 9e551cca5b
commit 63abe73c29
2 changed files with 30 additions and 0 deletions

View File

@@ -911,6 +911,35 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
{
}
- (void) ensureIDsForChildKeys: (NSArray *) keys
{
NSMutableArray *missingURLs;
MAPIStoreMapping *mapping;
NSUInteger count, max;
NSString *baseURL, *URL, *key;
NSArray *newIDs;
uint64_t idNbr;
baseURL = [self url];
mapping = [self mapping];
max = [keys count];
missingURLs = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
key = [keys objectAtIndex: count];
URL = [NSString stringWithFormat: @"%@%@", baseURL, key];
idNbr = [mapping idFromURL: URL];
if (idNbr == NSNotFound)
[missingURLs addObject: URL];
}
max = [missingURLs count];
newIDs = [[self context] getNewFMIDs: max];
[mapping registerURLs: missingURLs
withIDs: newIDs];
}
- (void) postNotificationsForMoveCopyMessagesWithMIDs: (uint64_t *) srcMids
andMessageURLs: (NSArray *) oldMessageURLs
andCount: (uint32_t) midCount