diff options
author | Joas Schilling <coding@schilljs.com> | 2020-10-30 17:19:03 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-11-26 11:46:43 +0300 |
commit | d5dbdeb6973b2b9249764d057a73fd682e6c6ee8 (patch) | |
tree | 9936e854ee313251c6228cb82ab681b2775ea12b /lib/Controller | |
parent | f3e6e5667f70300dcb0ef84546600ec2853b1108 (diff) |
Store the session given by the HPB for the actor
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r-- | lib/Controller/SignalingController.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Controller/SignalingController.php b/lib/Controller/SignalingController.php index f40570f5f..8a7ec39ec 100644 --- a/lib/Controller/SignalingController.php +++ b/lib/Controller/SignalingController.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace OCA\Talk\Controller; +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use OCA\Talk\Config; use OCA\Talk\Events\SignalingEvent; use OCA\Talk\Exceptions\RoomNotFoundException; @@ -586,6 +587,21 @@ class SignalingController extends OCSController { } if ($action === 'join') { + if ($sessionId && !$participant->getSession() instanceof Session) { + try { + $session = $this->sessionService->createSessionForAttendee($participant->getAttendee(), $sessionId); + } catch (UniqueConstraintViolationException $e) { + return new DataResponse([ + 'type' => 'error', + 'error' => [ + 'code' => 'duplicate_session', + 'message' => 'The given session is already in use.', + ], + ]); + } + $participant->setSession($session); + } + if ($participant->getSession() instanceof Session) { $this->sessionService->updateLastPing($participant->getSession(), $this->timeFactory->getTime()); } |