diff options
author | C. Montero Luque <cmonteroluque@users.noreply.github.com> | 2016-03-01 13:35:14 -0500 |
---|---|---|
committer | C. Montero Luque <cmonteroluque@users.noreply.github.com> | 2016-03-01 13:35:14 -0500 |
commit | c51a01b43f514fc50c47de1ed78d2bdfb8572621 (patch) | |
tree | c191f06bd08833e7b4d70a80ca8d9981c97b3d0d /apps/dav/appinfo/app.php | |
parent | 2d68c1b9450d77d21b08fc66436d286996583589 (diff) | |
parent | 745fdc48007d5d2f29c62266627731bd0ea0aa3d (diff) | |
download | nextcloud-server-c51a01b43f514fc50c47de1ed78d2bdfb8572621.tar.gz nextcloud-server-c51a01b43f514fc50c47de1ed78d2bdfb8572621.zip |
Merge branch 'master' into exclude-custom-data-dir
Diffstat (limited to 'apps/dav/appinfo/app.php')
-rw-r--r-- | apps/dav/appinfo/app.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/dav/appinfo/app.php b/apps/dav/appinfo/app.php index d33545222b0..5202e3d38b8 100644 --- a/apps/dav/appinfo/app.php +++ b/apps/dav/appinfo/app.php @@ -20,6 +20,7 @@ */ use OCA\Dav\AppInfo\Application; +use Symfony\Component\EventDispatcher\GenericEvent; $app = new Application(); $app->registerHooks(); @@ -28,6 +29,20 @@ $app->registerHooks(); return $app->getSyncService(); }); +$eventDispatcher = \OC::$server->getEventDispatcher(); + +$eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove', + function(GenericEvent $event) use ($app) { + /** @var \OCA\DAV\CardDAV\CardDavBackend $cardDavBackend */ + $cardDavBackend = $app->getContainer()->query('CardDavBackend'); + $addressBookUri = $event->getSubject(); + $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri); + if (!is_null($addressBook)) { + $cardDavBackend->deleteAddressBook($addressBook['id']); + } + } +); + $cm = \OC::$server->getContactsManager(); $cm->register(function() use ($cm, $app) { $userId = \OC::$server->getUserSession()->getUser()->getUID(); |