From 2056f1a0cdad06149d14663c57224e8d79e8b795 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Wed, 13 Nov 2024 17:26:04 -0500 Subject: [PATCH] Add SabreDav Patch for iTip Broker Signed-off-by: SebastianKrupinski --- .patches/custom-itip-broker.diff | 52 ++++++++++++++++++++++++ composer.patches.json | 1 + composer/installed.json | 1 + sabre/dav/PATCHES.txt | 4 ++ sabre/dav/lib/CalDAV/Schedule/Plugin.php | 15 +++++-- 5 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 .patches/custom-itip-broker.diff diff --git a/.patches/custom-itip-broker.diff b/.patches/custom-itip-broker.diff new file mode 100644 index 000000000..13c835816 --- /dev/null +++ b/.patches/custom-itip-broker.diff @@ -0,0 +1,52 @@ +diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php +index 5e56596101..5bca56d47e 100644 +--- a/lib/CalDAV/Schedule/Plugin.php ++++ b/lib/CalDAV/Schedule/Plugin.php +@@ -25,6 +25,7 @@ + use Sabre\VObject; + use Sabre\VObject\Component\VCalendar; + use Sabre\VObject\ITip; ++use Sabre\VObject\ITip\Broker; + use Sabre\VObject\ITip\Message; + use Sabre\VObject\Reader; + +@@ -389,7 +390,7 @@ public function beforeUnbind($path) + $node->getOwner() + ); + +- $broker = new ITip\Broker(); ++ $broker = $this->createITipBroker(); + $messages = $broker->parseEvent(null, $addresses, $node->get()); + + foreach ($messages as $message) { +@@ -500,7 +501,7 @@ public function scheduleLocalDelivery(ITip\Message $iTipMessage) + $isNewNode = true; + } + +- $broker = new ITip\Broker(); ++ $broker = $this->createITipBroker(); + $newObject = $broker->processMessage($iTipMessage, $currentObject); + + $inbox->createFile($newFileName, $iTipMessage->message->serialize()); +@@ -611,7 +612,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege + */ + protected function processICalendarChange($oldObject, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false) + { +- $broker = new ITip\Broker(); ++ $broker = $this->createITipBroker(); + $messages = $broker->parseEvent($newObject, $addresses, $oldObject); + + if ($messages) { +@@ -994,4 +995,12 @@ public function getPluginInfo() + 'link' => 'http://sabre.io/dav/scheduling/', + ]; + } ++ ++ /** ++ * Returns an instance of the iTip\Broker. ++ */ ++ protected function createITipBroker(): Broker ++ { ++ return new Broker(); ++ } + } diff --git a/composer.patches.json b/composer.patches.json index 96a4fa1ea..b86d16fd9 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -1,6 +1,7 @@ { "patches": { "sabre/dav": { + "Allow for custom iTip broker": ".patches/custom-itip-broker.diff", "Fix getNodeForPath cache": ".patches/fix-cache-for-node.diff" }, "wapmorgan/mp3info": { diff --git a/composer/installed.json b/composer/installed.json index d5a55069d..4b44cbc47 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -3684,6 +3684,7 @@ "type": "library", "extra": { "patches_applied": { + "Allow for custom iTip broker": ".patches/custom-itip-broker.diff", "Fix getNodeForPath cache": ".patches/fix-cache-for-node.diff" } }, diff --git a/sabre/dav/PATCHES.txt b/sabre/dav/PATCHES.txt index 9e202eda2..101f21ee6 100644 --- a/sabre/dav/PATCHES.txt +++ b/sabre/dav/PATCHES.txt @@ -1,6 +1,10 @@ This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches) Patches applied to this directory: +Allow for custom iTip broker +Source: .patches/custom-itip-broker.diff + + Fix getNodeForPath cache Source: .patches/fix-cache-for-node.diff diff --git a/sabre/dav/lib/CalDAV/Schedule/Plugin.php b/sabre/dav/lib/CalDAV/Schedule/Plugin.php index 5e5659610..5bca56d47 100644 --- a/sabre/dav/lib/CalDAV/Schedule/Plugin.php +++ b/sabre/dav/lib/CalDAV/Schedule/Plugin.php @@ -25,6 +25,7 @@ use Sabre\VObject; use Sabre\VObject\Component\VCalendar; use Sabre\VObject\ITip; +use Sabre\VObject\ITip\Broker; use Sabre\VObject\ITip\Message; use Sabre\VObject\Reader; @@ -389,7 +390,7 @@ public function beforeUnbind($path) $node->getOwner() ); - $broker = new ITip\Broker(); + $broker = $this->createITipBroker(); $messages = $broker->parseEvent(null, $addresses, $node->get()); foreach ($messages as $message) { @@ -500,7 +501,7 @@ public function scheduleLocalDelivery(ITip\Message $iTipMessage) $isNewNode = true; } - $broker = new ITip\Broker(); + $broker = $this->createITipBroker(); $newObject = $broker->processMessage($iTipMessage, $currentObject); $inbox->createFile($newFileName, $iTipMessage->message->serialize()); @@ -611,7 +612,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege */ protected function processICalendarChange($oldObject, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false) { - $broker = new ITip\Broker(); + $broker = $this->createITipBroker(); $messages = $broker->parseEvent($newObject, $addresses, $oldObject); if ($messages) { @@ -994,4 +995,12 @@ public function getPluginInfo() 'link' => 'http://sabre.io/dav/scheduling/', ]; } + + /** + * Returns an instance of the iTip\Broker. + */ + protected function createITipBroker(): Broker + { + return new Broker(); + } }