feat: add meeting started event

pull/77/head
sualko 2020-09-22 13:51:47 +02:00
parent f74ba3794b
commit 79921b6061
2 changed files with 18 additions and 1 deletions

View File

@ -9,6 +9,8 @@ use BigBlueButton\Parameters\GetRecordingsParameters;
use BigBlueButton\Core\Record; use BigBlueButton\Core\Record;
use BigBlueButton\Parameters\DeleteRecordingsParameters; use BigBlueButton\Parameters\DeleteRecordingsParameters;
use BigBlueButton\Parameters\IsMeetingRunningParameters; use BigBlueButton\Parameters\IsMeetingRunningParameters;
use OCP\EventDispatcher\IEventDispatcher;
use OCA\BigBlueButton\Event\MeetingStartedEvent;
use OCA\BigBlueButton\Db\Room; use OCA\BigBlueButton\Db\Room;
use OCA\BigBlueButton\Permission; use OCA\BigBlueButton\Permission;
use OCA\BigBlueButton\Crypto; use OCA\BigBlueButton\Crypto;
@ -31,16 +33,21 @@ class API {
/** @var Crypto */ /** @var Crypto */
private $crypto; private $crypto;
/** @var IEventDispatcher */
private $eventDispatcher;
public function __construct( public function __construct(
IConfig $config, IConfig $config,
IURLGenerator $urlGenerator, IURLGenerator $urlGenerator,
Permission $permission, Permission $permission,
Crypto $crypto Crypto $crypto,
IEventDispatcher $eventDispatcher
) { ) {
$this->config = $config; $this->config = $config;
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
$this->permission = $permission; $this->permission = $permission;
$this->crypto = $crypto; $this->crypto = $crypto;
$this->eventDispatcher = $eventDispatcher;
} }
private function getServer() { private function getServer() {
@ -96,6 +103,10 @@ class API {
throw new \Exception('Can not create meeting'); throw new \Exception('Can not create meeting');
} }
if ($response->getMessageKey() !== 'duplicateWarning') {
$this->eventDispatcher->dispatch(MeetingStartedEvent::class, new MeetingStartedEvent($room));
}
return $response->getCreationTime(); return $response->getCreationTime();
} }

View File

@ -0,0 +1,6 @@
<?php
namespace OCA\BigBlueButton\Event;
class MeetingStartedEvent extends RoomEvent {
}