Skip to content

Commit 059e167

Browse files
Merge pull request #1984 from nextcloud/fix/stable29/sabre-dav-itip-broker
[stable29] Add SabreDav Patch for iTip Broker
2 parents 6d5a80c + ff1bfae commit 059e167

5 files changed

Lines changed: 70 additions & 3 deletions

File tree

.patches/custom-itip-broker.diff

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
2+
index 5e56596101..5bca56d47e 100644
3+
--- a/lib/CalDAV/Schedule/Plugin.php
4+
+++ b/lib/CalDAV/Schedule/Plugin.php
5+
@@ -25,6 +25,7 @@
6+
use Sabre\VObject;
7+
use Sabre\VObject\Component\VCalendar;
8+
use Sabre\VObject\ITip;
9+
+use Sabre\VObject\ITip\Broker;
10+
use Sabre\VObject\ITip\Message;
11+
use Sabre\VObject\Reader;
12+
13+
@@ -389,7 +390,7 @@ public function beforeUnbind($path)
14+
$node->getOwner()
15+
);
16+
17+
- $broker = new ITip\Broker();
18+
+ $broker = $this->createITipBroker();
19+
$messages = $broker->parseEvent(null, $addresses, $node->get());
20+
21+
foreach ($messages as $message) {
22+
@@ -500,7 +501,7 @@ public function scheduleLocalDelivery(ITip\Message $iTipMessage)
23+
$isNewNode = true;
24+
}
25+
26+
- $broker = new ITip\Broker();
27+
+ $broker = $this->createITipBroker();
28+
$newObject = $broker->processMessage($iTipMessage, $currentObject);
29+
30+
$inbox->createFile($newFileName, $iTipMessage->message->serialize());
31+
@@ -611,7 +612,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege
32+
*/
33+
protected function processICalendarChange($oldObject, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false)
34+
{
35+
- $broker = new ITip\Broker();
36+
+ $broker = $this->createITipBroker();
37+
$messages = $broker->parseEvent($newObject, $addresses, $oldObject);
38+
39+
if ($messages) {
40+
@@ -994,4 +995,12 @@ public function getPluginInfo()
41+
'link' => 'http://sabre.io/dav/scheduling/',
42+
];
43+
}
44+
+
45+
+ /**
46+
+ * Returns an instance of the iTip\Broker.
47+
+ */
48+
+ protected function createITipBroker(): Broker
49+
+ {
50+
+ return new Broker();
51+
+ }
52+
}

composer.patches.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"patches": {
33
"sabre/dav": {
4+
"Allow for custom iTip broker": ".patches/custom-itip-broker.diff",
45
"Fix getNodeForPath cache": ".patches/fix-cache-for-node.diff"
56
},
67
"wapmorgan/mp3info": {

composer/installed.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3995,6 +3995,7 @@
39953995
"type": "library",
39963996
"extra": {
39973997
"patches_applied": {
3998+
"Allow for custom iTip broker": ".patches/custom-itip-broker.diff",
39983999
"Fix getNodeForPath cache": ".patches/fix-cache-for-node.diff"
39994000
}
40004001
},

sabre/dav/PATCHES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)
22
Patches applied to this directory:
33

4+
Allow for custom iTip broker
5+
Source: .patches/custom-itip-broker.diff
6+
7+
48
Fix getNodeForPath cache
59
Source: .patches/fix-cache-for-node.diff
610

sabre/dav/lib/CalDAV/Schedule/Plugin.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Sabre\VObject;
2626
use Sabre\VObject\Component\VCalendar;
2727
use Sabre\VObject\ITip;
28+
use Sabre\VObject\ITip\Broker;
2829
use Sabre\VObject\ITip\Message;
2930
use Sabre\VObject\Reader;
3031

@@ -389,7 +390,7 @@ public function beforeUnbind($path)
389390
$node->getOwner()
390391
);
391392

392-
$broker = new ITip\Broker();
393+
$broker = $this->createITipBroker();
393394
$messages = $broker->parseEvent(null, $addresses, $node->get());
394395

395396
foreach ($messages as $message) {
@@ -500,7 +501,7 @@ public function scheduleLocalDelivery(ITip\Message $iTipMessage)
500501
$isNewNode = true;
501502
}
502503

503-
$broker = new ITip\Broker();
504+
$broker = $this->createITipBroker();
504505
$newObject = $broker->processMessage($iTipMessage, $currentObject);
505506

506507
$inbox->createFile($newFileName, $iTipMessage->message->serialize());
@@ -611,7 +612,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege
611612
*/
612613
protected function processICalendarChange($oldObject, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false)
613614
{
614-
$broker = new ITip\Broker();
615+
$broker = $this->createITipBroker();
615616
$messages = $broker->parseEvent($newObject, $addresses, $oldObject);
616617

617618
if ($messages) {
@@ -994,4 +995,12 @@ public function getPluginInfo()
994995
'link' => 'http://sabre.io/dav/scheduling/',
995996
];
996997
}
998+
999+
/**
1000+
* Returns an instance of the iTip\Broker.
1001+
*/
1002+
protected function createITipBroker(): Broker
1003+
{
1004+
return new Broker();
1005+
}
9971006
}

0 commit comments

Comments
 (0)