Use the right cutoff date

pull/69/merge
Ludovic Marcotte 2014-12-22 12:39:58 -05:00
parent 8015688df3
commit ca4a754f2c
3 changed files with 31 additions and 10 deletions

View File

@ -738,17 +738,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
[syncCache setObject: [component objectForKey: @"c_lastmodified"] forKey: uid];
// No need to set dateCache for Contacts
if ((theFolderType == ActiveSyncEventFolder || theFolderType == ActiveSyncTaskFolder))
{
NSCalendarDate *d;
if ([[component objectForKey: @"c_cycleenddate"] intValue])
d = [NSCalendarDate dateWithTimeIntervalSince1970: [[component objectForKey: @"c_cycleenddate"] intValue]];
else if ([[component objectForKey: @"c_enddate"] intValue])
d = [NSCalendarDate dateWithTimeIntervalSince1970: [[component objectForKey: @"c_enddate"] intValue]];
else
d = [NSCalendarDate distantFuture];
[dateCache setObject: d forKey: uid];
}
if (updated)
[s appendString: @"<Change xmlns=\"AirSync:\">"];
else
{
// no need to set dateCache for Contacts
if ((theFolderType == ActiveSyncEventFolder || theFolderType == ActiveSyncTaskFolder))
[dateCache setObject: [componentObject startDate] ? [componentObject startDate] : [NSCalendarDate date] forKey: uid]; // FIXME: need to set proper date for recurring events - softDelete
[s appendString: @"<Add xmlns=\"AirSync:\">"];
}
[s appendString: @"<Add xmlns=\"AirSync:\">"];
[s appendFormat: @"<ServerId xmlns=\"AirSync:\">%@</ServerId>", uid];
[s appendString: @"<ApplicationData xmlns=\"AirSync:\">"];

1
NEWS
View File

@ -8,6 +8,7 @@ Enhancements
- initial support for empty sync request/response for EAS
- added the SOGoMaximumSyncResponseSize EAS configuration parameter to
support memory-limited sync response sizes
- we now not only use the creation date for event's cutoff date (EAS)
2.2.12a (2014-12-19)
--------------------

View File

@ -1165,7 +1165,14 @@ static NSArray *childRecordFields = nil;
int syncTokenInt;
fields = [NSMutableArray arrayWithObjects: @"c_name", @"c_component",
@"c_creationdate", @"c_lastmodified", nil];
@"c_creationdate", @"c_lastmodified", nil];
if ([[self folderType] isEqualToString: @"Appointment"])
{
[fields addObject: @"c_enddate"];
[fields addObject: @"c_cycleenddate"];
}
addFields = [[properties allValues] objectEnumerator];
while ((currentField = [addFields nextObject]))
if ([currentField length])
@ -1181,7 +1188,9 @@ static NSArray *childRecordFields = nil;
if (theStartDate)
{
EOQualifier *sinceDateQualifier = [EOQualifier qualifierWithQualifierFormat:
@"c_creationdate > %d", (int)[theStartDate timeIntervalSince1970]];
@"(c_enddate > %d OR c_enddate = NULL) OR (c_iscycle = 1 and (c_cycleenddate > %d OR c_cycleenddate = NULL))",
(int)[theStartDate timeIntervalSince1970],
(int)[theStartDate timeIntervalSince1970]];
qualifier = [[EOAndQualifier alloc] initWithQualifiers: sinceDateQualifier, qualifier,
nil];
@ -1211,7 +1220,9 @@ static NSArray *childRecordFields = nil;
if (theStartDate)
{
EOQualifier *sinceDateQualifier = [EOQualifier qualifierWithQualifierFormat:
@"c_creationdate > %d", (int)[theStartDate timeIntervalSince1970]];
@"(c_enddate > %d OR c_enddate = NULL) OR (c_iscycle = 1 and (c_cycleenddate > %d OR c_cycleenddate = NULL))",
(int)[theStartDate timeIntervalSince1970],
(int)[theStartDate timeIntervalSince1970]];
qualifier = [[EOAndQualifier alloc] initWithQualifiers: sinceDateQualifier, qualifier,
nil];