fix(calendar(dav)): add DAV:status to DAV:response only when deleted

Fixes #5163
This commit is contained in:
Francis Lachapelle committed 2022-01-21 14:47:32 -05:00
1 parent 969d68dbb6
commit b061046992
1 file changed
+16 -31
+16 -31
View File
@@ -1384,42 +1384,19 @@ static NSArray *childRecordFields = nil;
withToken: (int) syncToken withToken: (int) syncToken
andBaseURL: (NSString *) baseURL andBaseURL: (NSString *) baseURL
{ {
static NSString *status[] = { @"HTTP/1.1 404 Not Found",
@"HTTP/1.1 201 Created",
@"HTTP/1.1 200 OK" };
NSMutableArray *children; NSMutableArray *children;
NSString *href; NSString *href;
unsigned int statusIndex;
children = [NSMutableArray arrayWithCapacity: 3]; children = [NSMutableArray arrayWithCapacity: 3];
href = [NSString stringWithFormat: @"%@%@", href = [NSString stringWithFormat: @"%@%@", baseURL, [record objectForKey: @"c_name"]];
baseURL, [record objectForKey: @"c_name"]]; [children addObject: davElementWithContent (@"href", XMLNS_WEBDAV, href)];
[children addObject: davElementWithContent (@"href", XMLNS_WEBDAV,
href)];
if (syncToken)
{
if ([[record objectForKey: @"c_deleted"] intValue] > 0)
statusIndex = 0;
else
{
if ([[record objectForKey: @"c_creationdate"] intValue]
>= syncToken)
statusIndex = 1;
else
statusIndex = 2;
}
}
else
statusIndex = 1;
// NSLog (@"webdav sync: %@ (%@)", href, status[statusIndex]); if ([[record objectForKey: @"c_deleted"] intValue] > 0)
[children addObject: davElementWithContent (@"status", XMLNS_WEBDAV, [children addObject: davElementWithContent (@"status", XMLNS_WEBDAV, @"HTTP/1.1 404 Not Found")];
status[statusIndex])]; else
if (statusIndex) [children addObjectsFromArray: [self _davPropstatsWithProperties: properties
[children andMethodSelectors: selectors
addObjectsFromArray: [self _davPropstatsWithProperties: properties fromRecord: record]];
andMethodSelectors: selectors
fromRecord: record]];
return davElementWithContent (@"response", XMLNS_WEBDAV, children); return davElementWithContent (@"response", XMLNS_WEBDAV, children);
} }
@@ -1528,6 +1505,10 @@ static NSArray *childRecordFields = nil;
return valid; return valid;
} }
/**
DAV:sync-collection Report
https://datatracker.ietf.org/doc/html/rfc6578#section-3.2
*/
- (WOResponse *) davSyncCollection: (WOContext *) localContext - (WOResponse *) davSyncCollection: (WOContext *) localContext
{ {
WOResponse *r; WOResponse *r;
@@ -2347,6 +2328,10 @@ static NSArray *childRecordFields = nil;
NSZoneFree (NULL, propertiesArray); NSZoneFree (NULL, propertiesArray);
} }
/**
CALDAV:calendar-multiget REPORT
https://datatracker.ietf.org/doc/html/rfc4791#section-7.9
*/
- (WOResponse *) performMultigetInContext: (WOContext *) queryContext - (WOResponse *) performMultigetInContext: (WOContext *) queryContext
inNamespace: (NSString *) namespace inNamespace: (NSString *) namespace
{ {