From 4981d92cdd772f587d7271f9898c5787744c976d Mon Sep 17 00:00:00 2001 From: "Robert C. Schaller" Date: Mon, 18 Mar 2024 03:50:37 +0100 Subject: [PATCH] fix: respect sequence number increment of event organizer over automatic significance evaluation fixes nextcloud/server#41084 , nextcloud/calendar#4428 , nextcloud/calendar#848 (presumably closed prematurely), nextcloud/server#5222 and nextcloud/calendar#5744 Signed-off-by: Robert C. Schaller --- apps/dav/lib/CalDAV/Schedule/IMipPlugin.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index fcc2ae1e166c5..0242ad40c7cd7 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -18,6 +18,7 @@ * @author Thomas Citharel * @author Thomas Müller * @author Anna Larch + * @author Robert C. Schaller * * @license AGPL-3.0 * @@ -135,15 +136,6 @@ public function beforeWriteContent($uri, INode $node, $data, $modified): void { * @return void */ public function schedule(Message $iTipMessage) { - // Not sending any emails if the system considers the update - // insignificant. - if (!$iTipMessage->significantChange) { - if (!$iTipMessage->scheduleStatus) { - $iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email'; - } - return; - } - if (parse_url($iTipMessage->sender, PHP_URL_SCHEME) !== 'mailto' || parse_url($iTipMessage->recipient, PHP_URL_SCHEME) !== 'mailto') { return; @@ -175,6 +167,16 @@ public function schedule(Message $iTipMessage) { $oldVevent = !empty($modified['old']) && is_array($modified['old']) ? array_pop($modified['old']) : null; $isModified = isset($oldVevent); + $sequenceIncremented = ( $this->imipService->readPropertyWithDefault($vEvent, 'SEQUENCE', '') > ($oldVevent == null ? '' : $this->imipService->readPropertyWithDefault($oldVevent, 'SEQUENCE', '')) ); + // Not sending any emails if the system considers the update + // insignificant (refer to https://datatracker.ietf.org/doc/html/rfc5546#section-2.1.4 paragraph 1) + // AND sequence number has not changed (refer to https://datatracker.ietf.org/doc/html/rfc5546#section-2.1.4 paragraph 2) + if (!$iTipMessage->significantChange && !$sequenceIncremented) { + if (!$iTipMessage->scheduleStatus) { + $iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email'; + } + return; + } // No changed events after all - this shouldn't happen if there is significant change yet here we are // The scheduling status is debatable if(empty($vEvent)) {