aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV/CalendarImpl.php
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2023-09-25 14:47:02 +0200
committerAnna Larch <anna@nextcloud.com>2023-11-09 16:20:19 +0100
commitf14a4f8fd73c71e76a9747ac51e657030f5bb835 (patch)
tree6d5ec8e5365a72b83bfd270ce56bcbaa06703b8a /apps/dav/lib/CalDAV/CalendarImpl.php
parent1aa24c024e207b54df3867f5f7ccd67625ac0492 (diff)
downloadnextcloud-server-f14a4f8fd73c71e76a9747ac51e657030f5bb835.tar.gz
nextcloud-server-f14a4f8fd73c71e76a9747ac51e657030f5bb835.zip
feat(user status): automate user status for events
and automatically set a user status to free or busy depending on their calendar transparency, event status and availability settings Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'apps/dav/lib/CalDAV/CalendarImpl.php')
-rw-r--r--apps/dav/lib/CalDAV/CalendarImpl.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php
index cc57aa36469..de20c9ac3ae 100644
--- a/apps/dav/lib/CalDAV/CalendarImpl.php
+++ b/apps/dav/lib/CalDAV/CalendarImpl.php
@@ -33,11 +33,15 @@ use OCA\DAV\CalDAV\InvitationResponse\InvitationResponseServer;
use OCP\Calendar\Exceptions\CalendarException;
use OCP\Calendar\ICreateFromString;
use OCP\Calendar\IHandleImipMessage;
+use OCP\Calendar\ISchedulingInformation;
use OCP\Constants;
+use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp;
use Sabre\DAV\Exception\Conflict;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;
+use Sabre\VObject\Component\VTimeZone;
use Sabre\VObject\ITip\Message;
+use Sabre\VObject\Property;
use Sabre\VObject\Reader;
use function Sabre\Uri\split as uriSplit;
@@ -86,6 +90,29 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage {
return $this->calendarInfo['{http://apple.com/ns/ical/}calendar-color'];
}
+ public function getSchedulingTransparency(): ?ScheduleCalendarTransp {
+ return $this->calendarInfo['{' . \OCA\DAV\CalDAV\Schedule\Plugin::NS_CALDAV . '}schedule-calendar-transp'];
+ }
+
+ public function getSchedulingTimezone(): ?VTimeZone {
+ $tzProp = '{' . \OCA\DAV\CalDAV\Schedule\Plugin::NS_CALDAV . '}calendar-timezone';
+ if (!isset($this->calendarInfo[$tzProp])) {
+ return null;
+ }
+ // This property contains a VCALENDAR with a single VTIMEZONE
+ /** @var string $timezoneProp */
+ $timezoneProp = $this->calendarInfo[$tzProp];
+ /** @var VCalendar $vobj */
+ $vobj = Reader::read($timezoneProp);
+ $components = $vobj->getComponents();
+ if(empty($components)) {
+ return null;
+ }
+ /** @var VTimeZone $vtimezone */
+ $vtimezone = $components[0];
+ return $vtimezone;
+ }
+
/**
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match