aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/private/Calendar/CalendarEventBuilder.php15
-rw-r--r--lib/public/Calendar/CalendarEventStatus.php19
-rw-r--r--lib/public/Calendar/ICalendarEventBuilder.php7
5 files changed, 43 insertions, 0 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index abeaf0d513a..2d0b62d749f 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -190,6 +190,7 @@ return array(
'OCP\\Broadcast\\Events\\IBroadcastEvent' => $baseDir . '/lib/public/Broadcast/Events/IBroadcastEvent.php',
'OCP\\Cache\\CappedMemoryCache' => $baseDir . '/lib/public/Cache/CappedMemoryCache.php',
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => $baseDir . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
+ 'OCP\\Calendar\\CalendarEventStatus' => $baseDir . '/lib/public/Calendar/CalendarEventStatus.php',
'OCP\\Calendar\\Events\\AbstractCalendarObjectEvent' => $baseDir . '/lib/public/Calendar/Events/AbstractCalendarObjectEvent.php',
'OCP\\Calendar\\Events\\CalendarObjectCreatedEvent' => $baseDir . '/lib/public/Calendar/Events/CalendarObjectCreatedEvent.php',
'OCP\\Calendar\\Events\\CalendarObjectDeletedEvent' => $baseDir . '/lib/public/Calendar/Events/CalendarObjectDeletedEvent.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 956fa820ac5..64210bd5843 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -239,6 +239,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Broadcast\\Events\\IBroadcastEvent' => __DIR__ . '/../../..' . '/lib/public/Broadcast/Events/IBroadcastEvent.php',
'OCP\\Cache\\CappedMemoryCache' => __DIR__ . '/../../..' . '/lib/public/Cache/CappedMemoryCache.php',
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => __DIR__ . '/../../..' . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
+ 'OCP\\Calendar\\CalendarEventStatus' => __DIR__ . '/../../..' . '/lib/public/Calendar/CalendarEventStatus.php',
'OCP\\Calendar\\Events\\AbstractCalendarObjectEvent' => __DIR__ . '/../../..' . '/lib/public/Calendar/Events/AbstractCalendarObjectEvent.php',
'OCP\\Calendar\\Events\\CalendarObjectCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/Calendar/Events/CalendarObjectCreatedEvent.php',
'OCP\\Calendar\\Events\\CalendarObjectDeletedEvent' => __DIR__ . '/../../..' . '/lib/public/Calendar/Events/CalendarObjectDeletedEvent.php',
diff --git a/lib/private/Calendar/CalendarEventBuilder.php b/lib/private/Calendar/CalendarEventBuilder.php
index 9198d383ef9..1aa11c2436d 100644
--- a/lib/private/Calendar/CalendarEventBuilder.php
+++ b/lib/private/Calendar/CalendarEventBuilder.php
@@ -12,6 +12,7 @@ namespace OC\Calendar;
use DateTimeInterface;
use InvalidArgumentException;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Calendar\CalendarEventStatus;
use OCP\Calendar\ICalendarEventBuilder;
use OCP\Calendar\ICreateFromString;
use Sabre\VObject\Component\VCalendar;
@@ -23,6 +24,7 @@ class CalendarEventBuilder implements ICalendarEventBuilder {
private ?string $summary = null;
private ?string $description = null;
private ?string $location = null;
+ private ?CalendarEventStatus $status = null;
private ?array $organizer = null;
private array $attendees = [];
@@ -57,6 +59,11 @@ class CalendarEventBuilder implements ICalendarEventBuilder {
return $this;
}
+ public function setStatus(CalendarEventStatus $status): static {
+ $this->status = $status;
+ return $this;
+ }
+
public function setOrganizer(string $email, ?string $commonName = null): ICalendarEventBuilder {
$this->organizer = [$email, $commonName];
return $this;
@@ -91,6 +98,7 @@ class CalendarEventBuilder implements ICalendarEventBuilder {
'SUMMARY' => $this->summary,
'DTSTART' => $this->startDate,
'DTEND' => $this->endDate,
+ 'STATUS' => $this->status->value,
];
if ($this->description !== null) {
$props['DESCRIPTION'] = $this->description;
@@ -126,6 +134,13 @@ class CalendarEventBuilder implements ICalendarEventBuilder {
$params = [];
if ($cn !== null) {
$params['CN'] = $cn;
+ if ($name === 'ORGANIZER') {
+ $params['ROLE'] = 'CHAIR';
+ $params['PARTSTAT'] = 'ACCEPTED';
+ } else {
+ $params['ROLE'] = 'REQ-PARTICIPANT';
+ $params['PARTSTAT'] = 'NEEDS-ACTION';
+ }
}
$vevent->add($name, $email, $params);
}
diff --git a/lib/public/Calendar/CalendarEventStatus.php b/lib/public/Calendar/CalendarEventStatus.php
new file mode 100644
index 00000000000..5e070545758
--- /dev/null
+++ b/lib/public/Calendar/CalendarEventStatus.php
@@ -0,0 +1,19 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Calendar;
+
+/**
+ * The status of a calendar event.
+ *
+ * @since 32.0.0
+ */
+enum CalendarEventStatus: string {
+ case TENTATIVE = 'TENTATIVE';
+ case CONFIRMED = 'CONFIRMED';
+ case CANCELLED = 'CANCELLED';
+};
diff --git a/lib/public/Calendar/ICalendarEventBuilder.php b/lib/public/Calendar/ICalendarEventBuilder.php
index 8afc817a61e..c99dc60cc8c 100644
--- a/lib/public/Calendar/ICalendarEventBuilder.php
+++ b/lib/public/Calendar/ICalendarEventBuilder.php
@@ -66,6 +66,13 @@ interface ICalendarEventBuilder {
public function setLocation(string $location): self;
/**
+ * Set the event status.
+ *
+ * @since 32.0.0
+ */
+ public function setStatus(CalendarEventStatus $status): static;
+
+ /**
* Set the event organizer.
* This property is required if attendees are added!
*