Skip to content

Commit

Permalink
Allow for custom iTipBroker (sabre-io#1559)
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
  • Loading branch information
SebastianKrupinski authored and phil-davis committed Oct 29, 2024
1 parent 7af42cf commit dab90d5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions 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 dab90d5

Please sign in to comment.