Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Bauch <bauch@struktur.de>2019-10-02 15:17:57 +0300
committerJoas Schilling <coding@schilljs.com>2020-03-02 14:47:37 +0300
commitfdf5dcd4833f679b66bf2bcb580931a6b8c412fe (patch)
treeeda8d14f59210079caabafa8d8e053f8ba91f083 /lib/Room.php
parent8a53d9442dbbe0e60fd9a4ccb7ae6bb022410a73 (diff)
Get room properties for the signaling server from separate function.
Also dispatch an event so other apps can extend the properties to return. Signed-off-by: Joachim Bauch <bauch@struktur.de>
Diffstat (limited to 'lib/Room.php')
-rw-r--r--lib/Room.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Room.php b/lib/Room.php
index 8420b51d2..5073d68aa 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -36,6 +36,7 @@ use OCA\Talk\Events\ParticipantEvent;
use OCA\Talk\Events\RemoveParticipantEvent;
use OCA\Talk\Events\RemoveUserEvent;
use OCA\Talk\Events\RoomEvent;
+use OCA\Talk\Events\SignalingRoomPropertiesEvent;
use OCA\Talk\Events\VerifyRoomPasswordEvent;
use OCA\Talk\Exceptions\InvalidPasswordException;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
@@ -100,6 +101,7 @@ class Room {
public const EVENT_AFTER_SESSION_JOIN_CALL = self::class . '::postSessionJoinCall';
public const EVENT_BEFORE_SESSION_LEAVE_CALL = self::class . '::preSessionLeaveCall';
public const EVENT_AFTER_SESSION_LEAVE_CALL = self::class . '::postSessionLeaveCall';
+ public const EVENT_BEFORE_SIGNALING_PROPERTIES = self::class . '::beforeSignalingProperties';
/** @var Manager */
private $manager;
@@ -279,6 +281,23 @@ class Room {
}
/**
+ * Return the room properties to send to the signaling server.
+ *
+ * @param string $userId
+ * @return array
+ */
+ public function getPropertiesForSignaling(string $userId): array {
+ $properties = [
+ 'name' => $this->getDisplayName($userId),
+ 'type' => $this->getType(),
+ ];
+
+ $event = new SignalingRoomPropertiesEvent($this, $userId, $properties);
+ $this->dispatcher->dispatch(self::EVENT_BEFORE_SIGNALING_PROPERTIES, $event);
+ return $event->getProperties();
+ }
+
+ /**
* @param string|null $userId
* @return Participant
* @throws ParticipantNotFoundException When the user is not a participant