diff options
Diffstat (limited to 'lib/Listener')
-rw-r--r-- | lib/Listener/DeleteDraftListener.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Listener/DeleteDraftListener.php b/lib/Listener/DeleteDraftListener.php index 87f46b47a..469ef070b 100644 --- a/lib/Listener/DeleteDraftListener.php +++ b/lib/Listener/DeleteDraftListener.php @@ -32,11 +32,13 @@ use OCA\Mail\Db\Mailbox; use OCA\Mail\Db\MailboxMapper; use OCA\Mail\Db\Message; use OCA\Mail\Events\DraftSavedEvent; +use OCA\Mail\Events\MessageDeletedEvent; use OCA\Mail\Events\MessageSentEvent; use OCA\Mail\IMAP\IMAPClientFactory; use OCA\Mail\IMAP\MessageMapper; use OCP\AppFramework\Db\DoesNotExistException; use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventListener; use Psr\Log\LoggerInterface; @@ -54,14 +56,19 @@ class DeleteDraftListener implements IEventListener { /** @var LoggerInterface */ private $logger; + /** @var IEventDispatcher */ + private $eventDispatcher; + public function __construct(IMAPClientFactory $imapClientFactory, MailboxMapper $mailboxMapper, MessageMapper $messageMapper, - LoggerInterface $logger) { + LoggerInterface $logger, + IEventDispatcher $eventDispatcher) { $this->imapClientFactory = $imapClientFactory; $this->mailboxMapper = $mailboxMapper; $this->messageMapper = $messageMapper; $this->logger = $logger; + $this->eventDispatcher = $eventDispatcher; } public function handle(Event $event): void { @@ -105,6 +112,10 @@ class DeleteDraftListener implements IEventListener { 'exception' => $e, ]); } + + $this->eventDispatcher->dispatchTyped( + new MessageDeletedEvent($account, $draftsMailbox, $draft->getUid()) + ); } /** |