From 6269980fd5f4a5265037eef645c2d8e2ba1d91e3 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 27 Dec 2009 23:29:57 +1300 Subject: [PATCH] Add support for principal-search-property-set REPORT per RFC3744 --- inc/DAVResource.php | 1 + inc/caldav-REPORT-pps-set.php | 36 +++++++++++++++++++++++++++++++++++ inc/caldav-REPORT.php | 3 +++ 3 files changed, 40 insertions(+) create mode 100644 inc/caldav-REPORT-pps-set.php diff --git a/inc/DAVResource.php b/inc/DAVResource.php index f17c243f..493a9f6f 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -641,6 +641,7 @@ EOQRY; $this->supported_reports = array( 'DAV::principal-property-search' => '', + 'DAV::principal-search-property-set' => '', 'DAV::expand-property' => '', 'DAV::sync-collection' => '' ); diff --git a/inc/caldav-REPORT-pps-set.php b/inc/caldav-REPORT-pps-set.php new file mode 100644 index 00000000..395ea6e5 --- /dev/null +++ b/inc/caldav-REPORT-pps-set.php @@ -0,0 +1,36 @@ + +* @copyright Morphoss Ltd - http://www.morphoss.com/ +* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later +*/ + + +/** +* Wrap an individual property name as needed +*/ +function property_response( &$xmldoc, $property ) { + $prop = new XMLElement( 'prop' ); + $xmldoc->NSElement($prop, $property ); + return new XMLElement( 'principal-search-property', $prop ); +} + +$principal_search_property_set = array( + 'DAV::displayname', + 'http://calendarserver.org/ns/:email-address-set', + 'urn:ietf:params:xml:ns:caldav:calendar-home-set' +); + +$responses = array(); +foreach( $principal_search_property_set AS $k => $tag ) { + $responses[] = property_response( $reply, $tag ); +} + + +$report = new XMLElement( 'principal-search-property-set', $responses, $reply->GetXmlNsArray() ); + +$request->XMLResponse( 207, $report ); diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index 00dc66b8..32c59a51 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -52,6 +52,9 @@ switch( $xmltree->GetTag() ) { case 'DAV::principal-property-search': include("caldav-REPORT-principal.php"); exit; // Not that it should return anyway. + case 'DAV::principal-search-property-set': + include("caldav-REPORT-pps-set.php"); + exit; // Not that it should return anyway. case 'DAV::sync-collection': include("caldav-REPORT-sync-collection.php"); exit; // Not that it should return anyway.