From b3cc57b68388b68e4d4dcf0ddcd8c7ba455dd840 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Fri, 13 Sep 2024 05:27:40 -0400 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 + composer/installed.php | 4 +- sabre/dav/PATCHES.txt | 4 ++ sabre/dav/lib/CalDAV/Schedule/Plugin.php | 15 +++++-- 6 files changed, 72 insertions(+), 5 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 c86ca1583..9ba0c1d2e 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -3683,6 +3683,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/composer/installed.php b/composer/installed.php index a9110ae04..123b89dab 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'nextcloud/3rdparty', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => NULL, + 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -292,7 +292,7 @@ 'nextcloud/3rdparty' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => NULL, + 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), 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(); + } }