diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-08-30 12:19:54 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-09-04 12:47:29 +0300 |
commit | 90275abd7796a85c9107eddb7939ed8f1e569c46 (patch) | |
tree | 44ec8d5adb8c684031bdc3f1456cc9bdaca9f2bc /lib/AppInfo | |
parent | 0c59d64478ee20cd1f8371fdda489836af2ca5ce (diff) |
Clean up the code responsible for deleting a message
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/AppInfo')
-rw-r--r-- | lib/AppInfo/Application.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 6f12dca77..873eef879 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -29,7 +29,9 @@ use OCA\Mail\Contracts\IAvatarService; use OCA\Mail\Contracts\IMailManager; use OCA\Mail\Contracts\IMailTransmission; use OCA\Mail\Contracts\IUserPreferences; +use OCA\Mail\Events\BeforeMessageDeletedEvent; use OCA\Mail\Http\Middleware\ErrorMiddleware; +use OCA\Mail\Listener\MessageDeleteTrashCreatorListener; use OCA\Mail\Service\Attachment\AttachmentService; use OCA\Mail\Service\AvatarService; use OCA\Mail\Service\Group\IGroupService; @@ -38,6 +40,7 @@ use OCA\Mail\Service\MailManager; use OCA\Mail\Service\MailTransmission; use OCA\Mail\Service\UserPreferenceSevice; use OCP\AppFramework\App; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Util; class Application extends App { @@ -46,6 +49,7 @@ class Application extends App { parent::__construct('mail', $urlParams); $this->initializeAppContainer(); + $this->registerEvents(); } private function initializeAppContainer() { @@ -78,4 +82,11 @@ class Application extends App { $container->registerAlias(IGroupService::class, NextcloudGroupService::class); } + private function registerEvents(): void { + /** @var IEventDispatcher $dispatcher */ + $dispatcher = $this->getContainer()->query(IEventDispatcher::class); + + $dispatcher->addServiceListener(BeforeMessageDeletedEvent::class, MessageDeleteTrashCreatorListener::class); + } + } |