oc: sync old messages as last resort if there are not in cache

This is happening when the lastModSeq is greater than the modseq
from an old message and that message is not in cache.

This is used as last resort before crashing and it is only used
in objectVersion as it is the first place to call on sync. Other
related properties would work.
This commit is contained in:
Enrique J. Hernández Blasco
2014-11-19 00:23:16 +01:00
committed by Julio García
parent ef7b919175
commit a8b716fbaa
3 changed files with 79 additions and 2 deletions

View File

@@ -369,6 +369,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
{
uint64_t version = ULLONG_MAX;
NSString *uid, *changeNumber;
BOOL synced;
uid = [(MAPIStoreMailFolder *)
container messageUIDFromMessageKey: [self nameInContainer]];
@@ -387,8 +388,19 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
[self logWithFormat: @"got one"];
else
{
[self errorWithFormat: @"still nothing. We crash!"];
abort();
[self warnWithFormat: @"attempting to get change number"
@" by synchronising this specific message..."];
synced = [(MAPIStoreMailFolder *) container synchroniseCacheForUID: uid];
if (synced)
{
changeNumber = [(MAPIStoreMailFolder *) container
changeNumberForMessageUID: uid];
}
else
{
[self errorWithFormat: @"still nothing. We crash!"];
abort();
}
}
}
version = [changeNumber unsignedLongLongValue] >> 16;