oc-folder: Make deleted items synched when shared

By keeping mid on moving messages by soft deleting and
only if srcMid is different from targetMid.

This makes restore/shared deleted items work.

It also requires to do the following to work smoothly:

* Do not add soft-deleted messages in ensureIDsForChildKeys
* Return soft-deleted messages on getDeletedFMIDs
* Do not register a new mid if the URL is matched with soft deleted messages
This commit is contained in:
Enrique J. Hernández Blasco
2014-10-15 00:35:17 +02:00
committed by Julio García
parent 35ca313c37
commit b67e1deda5
3 changed files with 36 additions and 11 deletions

View File

@@ -160,6 +160,21 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
return NSNotFound;
}
- (uint64_t) idFromURL: (NSString *) url
isSoftDeleted: (bool *) softDeleted
{
enum mapistore_error ret;
uint64_t idNbr;
ret = indexing->get_fmid(indexing, [username UTF8String], [url UTF8String],
false, &idNbr, softDeleted);
if (ret != MAPISTORE_SUCCESS)
return NSNotFound;
return idNbr;
}
- (void) _updateFolderWithURL: (NSString *) oldURL
withURL: (NSString *) urlString
{
@@ -217,7 +232,7 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
{
NSString *oldURL;
uint64_t oldIdNbr;
bool rc;
bool rc, softDeleted;
oldURL = [self urlFromID: idNbr];
if (oldURL != NULL)
@@ -228,13 +243,16 @@ MAPIStoreMappingKeyFromId (uint64_t idNbr)
return NO;
}
oldIdNbr = [self idFromURL: urlString];
oldIdNbr = [self idFromURL: urlString isSoftDeleted: &softDeleted];
if (oldIdNbr != NSNotFound)
{
[self errorWithFormat:
@"attempt to double register an entry with idNbr ('%@', %lld,"
@" 0x%.16"PRIx64", oldid=0x%.16"PRIx64")",
urlString, idNbr, idNbr, oldIdNbr];
if (softDeleted)
[self logWithFormat: @"Attempt to register a soft-deleted %@", urlString];
else
[self errorWithFormat:
@"attempt to double register an entry with idNbr ('%@', %lld,"
@" 0x%.16"PRIx64", oldid=0x%.16"PRIx64")",
urlString, idNbr, idNbr, oldIdNbr];
return NO;
}
else