From 79921b6061ec2e71bf4cfd26075ccab03e55fed6 Mon Sep 17 00:00:00 2001 From: sualko Date: Tue, 22 Sep 2020 13:51:47 +0200 Subject: [PATCH] feat: add meeting started event --- lib/BigBlueButton/API.php | 13 ++++++++++++- lib/Event/MeetingStartedEvent.php | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/Event/MeetingStartedEvent.php diff --git a/lib/BigBlueButton/API.php b/lib/BigBlueButton/API.php index 5180dc9..f3c7e76 100644 --- a/lib/BigBlueButton/API.php +++ b/lib/BigBlueButton/API.php @@ -9,6 +9,8 @@ use BigBlueButton\Parameters\GetRecordingsParameters; use BigBlueButton\Core\Record; use BigBlueButton\Parameters\DeleteRecordingsParameters; use BigBlueButton\Parameters\IsMeetingRunningParameters; +use OCP\EventDispatcher\IEventDispatcher; +use OCA\BigBlueButton\Event\MeetingStartedEvent; use OCA\BigBlueButton\Db\Room; use OCA\BigBlueButton\Permission; use OCA\BigBlueButton\Crypto; @@ -31,16 +33,21 @@ class API { /** @var Crypto */ private $crypto; + /** @var IEventDispatcher */ + private $eventDispatcher; + public function __construct( IConfig $config, IURLGenerator $urlGenerator, Permission $permission, - Crypto $crypto + Crypto $crypto, + IEventDispatcher $eventDispatcher ) { $this->config = $config; $this->urlGenerator = $urlGenerator; $this->permission = $permission; $this->crypto = $crypto; + $this->eventDispatcher = $eventDispatcher; } private function getServer() { @@ -96,6 +103,10 @@ class API { throw new \Exception('Can not create meeting'); } + if ($response->getMessageKey() !== 'duplicateWarning') { + $this->eventDispatcher->dispatch(MeetingStartedEvent::class, new MeetingStartedEvent($room)); + } + return $response->getCreationTime(); } diff --git a/lib/Event/MeetingStartedEvent.php b/lib/Event/MeetingStartedEvent.php new file mode 100644 index 0000000..c855077 --- /dev/null +++ b/lib/Event/MeetingStartedEvent.php @@ -0,0 +1,6 @@ +