diff options
author | Joachim Bauch <bauch@struktur.de> | 2018-05-08 12:04:00 +0300 |
---|---|---|
committer | Joachim Bauch <bauch@struktur.de> | 2018-05-08 12:41:22 +0300 |
commit | 98b429e8d5c2a9a9470cea476b3335f52615e2cf (patch) | |
tree | c55d0009bc66ff2efdcd3315aaf011552047bddf /lib/Signaling | |
parent | 0321133f11581942d6c4188479ff6e2d1c52b606 (diff) |
Notify standalone signaling backend when a guest name is changed.
Signed-off-by: Joachim Bauch <bauch@struktur.de>
Diffstat (limited to 'lib/Signaling')
-rw-r--r-- | lib/Signaling/BackendNotifier.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php index aa9ebf5ec..9efc5bc6f 100644 --- a/lib/Signaling/BackendNotifier.php +++ b/lib/Signaling/BackendNotifier.php @@ -213,6 +213,42 @@ class BackendNotifier{ } /** + * The participant list of the given room has been modified. + * + * @param Room $room + * @throws \Exception + */ + public function participantsModified($room, $sessionIds) { + $this->logger->info('Room participants modified: ' . $room->getToken() . ' ' . print_r($sessionIds, true), ['app' => 'spreed']); + $changed = []; + $users = []; + $participants = $room->getParticipants(); + foreach ($participants['users'] as $userId => $participant) { + $participant['userId'] = $userId; + $users[] = $participant; + if (in_array($participant['sessionId'], $sessionIds)) { + $changed[] = $participant; + } + } + foreach ($participants['guests'] as $participant) { + if (!isset($participant['participantType'])) { + $participant['participantType'] = Participant::GUEST; + } + $users[] = $participant; + if (in_array($participant['sessionId'], $sessionIds)) { + $changed[] = $participant; + } + } + $this->backendRequest('/api/v1/room/' . $room->getToken(), [ + 'type' => 'participants', + 'participants' => [ + 'changed' => $changed, + 'users' => $users + ], + ]); + } + + /** * The "in-call" status of the given session ids has changed.. * * @param Room $room |