From 35e21ab66f5bdc6ccc5caebe4a881860cfc2aa2a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 25 Oct 2008 13:15:14 +1300 Subject: [PATCH] Quote getctag response to match getetag. Try and output calendar-free-busy-set for queries against the inbox which request it. --- inc/caldav-PROPFIND.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 04feb6da..03dba56e 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -328,6 +328,11 @@ function collection_to_xml( $collection ) { $not_found = new XMLElement("prop"); $denied = new XMLElement("prop"); + $collection->type = ($collection->is_calendar == 't' ? 'calendar' : ($collection->is_principal == 't' ? 'principal' : '') ); + if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $collection->dav_name, $matches ) ) { + $collection->type = $matches[3]; + } + /** * First process any static values we do support */ @@ -354,9 +359,6 @@ function collection_to_xml( $collection ) { || isset($prop_list['DAV::resourcetype']) ) { $resourcetypes = array( new XMLElement("collection") ); $contentlength = false; - if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $collection->dav_name, $matches ) ) { - $collection->type = $matches[3]; - } if ( $collection->is_calendar == 't' ) { $resourcetypes[] = new XMLElement($reply->Caldav("calendar"), false); $resourcetypes[] = new XMLElement($reply->Caldav("schedule-calendar"), false); @@ -388,13 +390,13 @@ function collection_to_xml( $collection ) { } if ( isset($prop_list['http://calendarserver.org/ns/:getctag']) ) { // Calendar Server extension which only applies to collections. We return the etag, which does the needful. - $prop->NewElement($reply->Calendarserver('getctag'),$collection->dav_etag ); + $prop->NewElement($reply->Calendarserver('getctag'),'"'.$collection->dav_etag.'"' ); } if ( isset($prop_list['urn:ietf:params:xml:ns:caldav:calendar-free-busy-set'] ) ) { - if ( isset($collection->is_inbox) && $collection->is_inbox && $session->user_no == $collection->user_no ) { + if ( $collection->type == 'in' && $session->user_no == $collection->user_no ) { $fb_set = array(); - foreach( $collection->free_busy_set AS $k => $v ) { + foreach( $request->principal->calendar_free_busy_set AS $k => $v ) { $fb_set[] = new XMLElement('href', $v ); } $prop->NewElement($reply->Caldav("calendar-free-busy-set"), $fb_set );