From 1f0ee840069ad51ad86f7e8c2f0cc6a6d26e0e3c Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 25 Oct 2008 11:15:46 +1300 Subject: [PATCH] Include correct resourcetypes for inbox/outbox/schedule-calendar. --- inc/caldav-PROPFIND.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index eb27d1c9..04feb6da 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -354,13 +354,23 @@ 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); $lqry = new PgQuery("SELECT sum(length(caldav_data)) FROM caldav_data WHERE user_no = ? AND dav_name ~ ?;", $collection->user_no, $collection->dav_name.'[^/]+$' ); if ( $lqry->Exec("PROPFIND",__LINE__,__FILE__) && $row = $lqry->Fetch() ) { $contentlength = $row->sum; } } + else if ( $collection->type == 'in' ) { + $resourcetypes[] = new XMLElement($reply->Caldav("schedule-inbox"), false); + } + else if ( $collection->type == 'out' ) { + $resourcetypes[] = new XMLElement($reply->Caldav("schedule-outbox"), false); + } if ( $collection->is_principal == 't' ) { $resourcetypes[] = new XMLElement("principal"); }