Set CalDAV birthdays ctag. Fix #309

master
Thomas Tanghus 2014-02-04 22:53:50 +01:00
parent 1b830372de
commit 1cbef55a22
1 changed files with 10 additions and 1 deletions

View File

@ -58,12 +58,21 @@ class OC_Connector_Sabre_CalDAV extends Sabre_CalDAV_Backend_Abstract {
$calendars[] = $calendar;
}
if(\OCP\App::isEnabled('contacts')) {
$ctag = 0;
$app = new \OCA\Contacts\App();
$addressBooks = $app->getAddressBooksForUser();
foreach($addressBooks as $addressBook) {
$tmp = $addressBook->lastModified();
if(!is_null($tmp)) {
$ctag = max($ctag, $tmp);
}
}
$calendars[] = array(
'id' => 'contact_birthdays',
'uri' => 'contact_birthdays',
'{DAV:}displayname' => (string)OC_Calendar_App::$l10n->t('Contact birthdays'),
'principaluri' => 'principals/contact_birthdays',
'{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => '0',
'{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $ctag,
'{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set'
=> new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT')),
);