Added method to get synctag starting from an other one.

We also no longer fetch vanished items of modseq == 0
This commit is contained in:
Ludovic Marcotte
2014-02-17 08:41:12 -05:00
parent c686e3294d
commit 2356562778
3 changed files with 1971 additions and 6 deletions
+1
View File
@@ -94,6 +94,7 @@
- (NSCalendarDate *) mostRecentMessageDate;
- (NSString *) davCollectionTagFromId: (NSString *) theId;
- (NSString *) davCollectionTag;
- (NSArray *) syncTokenFieldsWithProperties: (NSDictionary *) properties
+34 -6
View File
@@ -1925,6 +1925,27 @@ static NSString *defaultUserID = @"anyone";
return date;
}
- (NSString *) davCollectionTagFromId: (NSString *) theId
{
NSString *tag;
tag = @"-1";
if ([self imap4Connection])
{
NSDictionary *result;
unsigned int modseq, uid;
uid = [theId intValue];
result = [[imap4 client] fetchModseqForUid: uid];
modseq = [[[[result objectForKey: @"RawResponse"] objectForKey: @"fetch"] objectForKey: @"modseq"] intValue];
tag = [NSString stringWithFormat: @"%d-%d", uid, modseq-1];
}
return tag;
}
- (NSString *) davCollectionTag
{
NSString *tag;
@@ -1976,10 +1997,14 @@ static NSString *defaultUserID = @"anyone";
//
// Check updated items
//
//
//
// . uid fetch 1:* (FLAGS) (changedsince 171)
//
// To get the modseq of a specific message:
//
// . uid fetch 124569:124569 uid (changedsince 1)
//
//
// Deleted: "UID FETCH 1:* (UID) (CHANGEDSINCE 171 VANISHED)"
// fetchUIDsOfVanishedItems ..
@@ -2073,12 +2098,15 @@ static NSString *defaultUserID = @"anyone";
// We fetch deleted ones
uids = [self fetchUIDsOfVanishedItems: highestmodseq];
for (i = 0; i < [uids count]; i++)
if (highestmodseq > 0)
{
d = [NSDictionary dictionaryWithObject: @"deleted" forKey: [uids objectAtIndex: i]];
[allTokens addObject: d];
uids = [self fetchUIDsOfVanishedItems: highestmodseq];
for (i = 0; i < [uids count]; i++)
{
d = [NSDictionary dictionaryWithObject: @"deleted" forKey: [uids objectAtIndex: i]];
[allTokens addObject: d];
}
}
return allTokens;
File diff suppressed because it is too large Load Diff