[Pkg-owncloud-commits] [php-sabredav] 114/275: Processing deletes.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:55:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit d2e25f8ffec895f086614edc57a063ea7a81518f
Author: Evert Pot <me at evertpot.com>
Date:   Tue Jul 29 17:40:09 2014 -0400

    Processing deletes.
---
 lib/CalDAV/Schedule/Plugin.php | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index 97ac49a..8e99e8a 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -129,6 +129,7 @@ class Plugin extends ServerPlugin {
         $server->on('propFind',            [$this, 'propFind']);
         $server->on('beforeCreateFile',    [$this, 'beforeCreateFile']);
         $server->on('beforeWriteContent',  [$this, 'beforeWriteContent']);
+        $server->on('beforeUnbind',        [$this, 'beforeUnbind']);
         $server->on('schedule',            [$this, 'scheduleLocalDelivery']);
 
         /**
@@ -436,6 +437,36 @@ class Plugin extends ServerPlugin {
     }
 
     /**
+     * This method is triggered before a file gets deleted.
+     *
+     * We use this event to make sure that when this happens, attendees get
+     * cancellations, and organizers get 'DECLINED' statuses.
+     *
+     * @param string $path
+     * @return void
+     */
+    public function beforeUnbind($path) {
+
+        $node = $this->server->tree->getNodeForPath($path);
+
+        if (!$node instanceof ICalendarObject) {
+            return;
+        }
+
+        $addresses = $this->getAddressesForPrincipal(
+            $node->getOwner()
+        );
+
+        $broker = new ITip\Broker();
+        $messages = $broker->parseEvent(null, $addresses, $node->get());
+
+        foreach($messages as $message) {
+            $this->deliver($message);
+        }
+
+    }
+
+    /**
      * Event handler for the 'schedule' event.
      *
      * This handler attempts to look at local accounts to deliver the

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list