Skip to content

Commit

Permalink
Merge pull request #1939 from nextcloud/fix/sabre-dav-itip-broker
Browse files Browse the repository at this point in the history
Add SabreDav Patch for iTip Broker
  • Loading branch information
SebastianKrupinski authored Sep 15, 2024
2 parents 9e4e23d + b3cc57b commit 1a2aa63
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 5 deletions.
52 changes: 52 additions & 0 deletions .patches/custom-itip-broker.diff
Original file line number Diff line number Diff line change
@@ -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();
+ }
}
1 change: 1 addition & 0 deletions composer.patches.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
1 change: 1 addition & 0 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand Down
4 changes: 2 additions & 2 deletions composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 4 additions & 0 deletions sabre/dav/PATCHES.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
15 changes: 12 additions & 3 deletions sabre/dav/lib/CalDAV/Schedule/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
}
}

0 comments on commit 1a2aa63

Please sign in to comment.