Skip to content

Commit

Permalink
fix(calendar(dav)): add DAV:status to DAV:response only when deleted
Browse files Browse the repository at this point in the history
Fixes #5163
  • Loading branch information
cgx committed Feb 21, 2022
1 parent 5d0a48d commit 9bffee2
Showing 1 changed file with 16 additions and 31 deletions.
47 changes: 16 additions & 31 deletions SoObjects/SOGo/SOGoGCSFolder.m
Original file line number Diff line number Diff line change
Expand Up @@ -1369,42 +1369,19 @@ - (NSDictionary *) _syncResponseWithProperties: (NSArray *) properties
withToken: (int) syncToken
andBaseURL: (NSString *) baseURL
{
static NSString *status[] = { @"HTTP/1.1 404 Not Found",
@"HTTP/1.1 201 Created",
@"HTTP/1.1 200 OK" };
NSMutableArray *children;
NSString *href;
unsigned int statusIndex;

children = [NSMutableArray arrayWithCapacity: 3];
href = [NSString stringWithFormat: @"%@%@",
baseURL, [record objectForKey: @"c_name"]];
[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;
href = [NSString stringWithFormat: @"%@%@", baseURL, [record objectForKey: @"c_name"]];
[children addObject: davElementWithContent (@"href", XMLNS_WEBDAV, href)];

// NSLog (@"webdav sync: %@ (%@)", href, status[statusIndex]);
[children addObject: davElementWithContent (@"status", XMLNS_WEBDAV,
status[statusIndex])];
if (statusIndex)
[children
addObjectsFromArray: [self _davPropstatsWithProperties: properties
andMethodSelectors: selectors
fromRecord: record]];
if ([[record objectForKey: @"c_deleted"] intValue] > 0)
[children addObject: davElementWithContent (@"status", XMLNS_WEBDAV, @"HTTP/1.1 404 Not Found")];
else
[children addObjectsFromArray: [self _davPropstatsWithProperties: properties
andMethodSelectors: selectors
fromRecord: record]];

return davElementWithContent (@"response", XMLNS_WEBDAV, children);
}
Expand Down Expand Up @@ -1513,6 +1490,10 @@ - (BOOL) _isValidSyncToken: (NSString *) syncToken
return valid;
}

/**
DAV:sync-collection Report
https://datatracker.ietf.org/doc/html/rfc6578#section-3.2
*/
- (WOResponse *) davSyncCollection: (WOContext *) localContext
{
WOResponse *r;
Expand Down Expand Up @@ -2307,6 +2288,10 @@ - (void) _appendComponentProperties: (NSDictionary *) properties
NSZoneFree (NULL, propertiesArray);
}

/**
CALDAV:calendar-multiget REPORT
https://datatracker.ietf.org/doc/html/rfc4791#section-7.9
*/
- (WOResponse *) performMultigetInContext: (WOContext *) queryContext
inNamespace: (NSString *) namespace
{
Expand Down

0 comments on commit 9bffee2

Please sign in to comment.