diff options
author | Mario Danic <mario@lovelyhq.com> | 2018-11-09 08:32:34 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-11-12 11:35:31 +0100 |
commit | 3d9fb47a0dac5122f633688f42b4c16b397f11eb (patch) | |
tree | 020a9719177cba5211fef50d1b3b05149c625494 | |
parent | c58cfc54a40fb35eb6b6d0283deebad4016f5347 (diff) |
Add session id to participant
This allows for showing if user is online or not in the conversation info list without needing another API call
Signed-off-by: Mario Danic <mario@lovelyhq.com>
-rw-r--r-- | lib/Controller/RoomController.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index ad29ca481..38789491f 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -254,13 +254,23 @@ class RoomController extends OCSController { foreach ($participants['users'] as $userId => $data) { $user = $this->userManager->get((string) $userId); if ($user instanceof IUser) { - $participantList[(string) $user->getUID()] = [ + $participantList[(string)$user->getUID()] = [ 'name' => $user->getDisplayName(), 'type' => $data['participantType'], 'call' => $data['inCall'], + 'sessionId' => $user->getSessionId(), ]; + + try { + $participant = $room->getParticipant((string)$user->getUID()); + $participantList[(string)$user->getUID()]['participantFlags'] = $participant->getInCallFlags(); + } catch (ParticipantNotFoundException $e) { + // In case this happens we remove the user from the participants list + unset($participantList[(string)$user->getUID()]); + } } + if ($data['sessionId'] !== '0' && $data['lastPing'] <= time() - 100) { $room->leaveRoom((string) $userId); } |