summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/events.md6
-rw-r--r--lib/Config.php3
-rw-r--r--lib/Events/BeforeTurnServersGetEvent.php51
-rw-r--r--lib/Events/GetTurnServersEvent.php3
4 files changed, 63 insertions, 0 deletions
diff --git a/docs/events.md b/docs/events.md
index 7cef08360..7e89052b0 100644
--- a/docs/events.md
+++ b/docs/events.md
@@ -345,6 +345,12 @@ These events were not using the typed-event mechanism and are therefore deprecat
## Other events
+### Turn servers get
+
+* Before event: `OCA\Talk\Events\BeforeTurnServersGetEvent`
+* After event: *Not available*
+* Since: 18.0.0
+
### Signaling room properties sent
* Before event: `OCA\Talk\Events\BeforeSignalingRoomPropertiesSentEvent`
diff --git a/lib/Config.php b/lib/Config.php
index a0faf34b5..0e4a033fd 100644
--- a/lib/Config.php
+++ b/lib/Config.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace OCA\Talk;
+use OCA\Talk\Events\BeforeTurnServersGetEvent;
use OCA\Talk\Events\GetTurnServersEvent;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Service\RecordingService;
@@ -342,6 +343,8 @@ class Config {
if ($withEvent) {
$event = new GetTurnServersEvent($servers);
$this->dispatcher->dispatchTyped($event);
+ $event = new BeforeTurnServersGetEvent($event->getServers());
+ $this->dispatcher->dispatchTyped($event);
$servers = $event->getServers();
}
diff --git a/lib/Events/BeforeTurnServersGetEvent.php b/lib/Events/BeforeTurnServersGetEvent.php
new file mode 100644
index 000000000..368dfd10b
--- /dev/null
+++ b/lib/Events/BeforeTurnServersGetEvent.php
@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2021 Joachim Bauch <mail@joachim-bauch.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Talk\Events;
+
+use OCP\EventDispatcher\Event;
+
+class BeforeTurnServersGetEvent extends Event {
+ /**
+ * @param list<array{schemes?: string, server: string, protocols: string, username?: string, password?: string, secret?: string}> $servers
+ */
+ public function __construct(
+ protected array $servers
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @return list<array{schemes?: string, server: string, protocols: string, username?: string, password?: string, secret?: string}>
+ */
+ public function getServers(): array {
+ return $this->servers;
+ }
+
+ /**
+ * @param list<array{schemes?: string, server: string, protocols: string, username?: string, password?: string, secret?: string}> $servers
+ */
+ public function setServers(array $servers): void {
+ $this->servers = $servers;
+ }
+}
diff --git a/lib/Events/GetTurnServersEvent.php b/lib/Events/GetTurnServersEvent.php
index ac5fa58af..a3f01de18 100644
--- a/lib/Events/GetTurnServersEvent.php
+++ b/lib/Events/GetTurnServersEvent.php
@@ -25,6 +25,9 @@ namespace OCA\Talk\Events;
use OCP\EventDispatcher\Event;
+/**
+ * @deprecated
+ */
class GetTurnServersEvent extends Event {
public function __construct(