Skip to content

Commit

Permalink
fix: respect sequence number increment of event organizer over automa…
Browse files Browse the repository at this point in the history
…tic significance evaluation

fixes nextcloud#41084 , nextcloud/calendar#4428 , nextcloud/calendar#848 (presumably closed prematurely), nextcloud#5222 and nextcloud/calendar#5744

Signed-off-by: Robert C. Schaller <gtbc_robert.schaller@rsxc.de>
  • Loading branch information
rcwschaller committed Mar 18, 2024
1 parent 9f1f123 commit 4981d92
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @author Thomas Citharel <nextcloud@tcit.fr>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Anna Larch <anna.larch@gmx.net>
* @author Robert C. Schaller <gtbc_robert.schaller@rsxc.de>
*
* @license AGPL-3.0
*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 4981d92

Please sign in to comment.