From f5dc6c669f430f522ae03dcc7423cb48ca30983c Mon Sep 17 00:00:00 2001 From: Marten Gajda Date: Wed, 27 May 2015 19:49:27 +0200 Subject: [PATCH] Add component parameter to content-types headers and getcontenttype properties This allows clients to filter the results quickly by just looking at the content-type without having to parse the calendar data. --- inc/DAVResource.php | 1 + inc/caldav-GET.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/DAVResource.php b/inc/DAVResource.php index 4f0d5110..56abd4a2 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -274,6 +274,7 @@ class DAVResource if ( isset($this->resource->summary) )$this->resource->displayname = $this->resource->summary; if ( strtoupper(substr($this->resource->caldav_data,0,15)) == 'BEGIN:VCALENDAR' ) { $this->contenttype = 'text/calendar'; + if ( isset($this->resource->caldav_type) ) $this->contenttype .= "; component=" . strtolower($this->resource->caldav_type); if ( !$this->HavePrivilegeTo('read') && $this->HavePrivilegeTo('read-free-busy') ) { $vcal = new iCalComponent($this->resource->caldav_data); $confidential = $vcal->CloneConfidential(); diff --git a/inc/caldav-GET.php b/inc/caldav-GET.php index 2f4b18e8..34effa5e 100644 --- a/inc/caldav-GET.php +++ b/inc/caldav-GET.php @@ -72,7 +72,7 @@ switch( $resource->caldav_type ) { case 'VJOURNAL': case 'VEVENT': case 'VTODO': - $contenttype = 'text/calendar'; + $contenttype = 'text/calendar; component=' . strtolower($resource->caldav_type); break; case 'VCARD':