Browse Source

Remove self-joined users from the list after leaving

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/402/head
Joas Schilling 8 years ago
parent
commit
5ba66c0de0
No known key found for this signature in database GPG Key ID: E166FD8976B3BAC8
  1. 14
      lib/Controller/CallController.php

14
lib/Controller/CallController.php

@ -28,6 +28,7 @@ namespace OCA\Spreed\Controller;
use OCA\Spreed\Exceptions\InvalidPasswordException;
use OCA\Spreed\Exceptions\RoomNotFoundException;
use OCA\Spreed\Manager;
use OCA\Spreed\Participant;
use OCA\Spreed\Signalling\Messages;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
@ -197,7 +198,18 @@ class CallController extends OCSController {
*/
public function leaveCall($token) {
if ($this->userId !== null) {
// TODO: Currently we ignore $token, should be fixed at some point
try {
$room = $this->manager->getRoomForParticipantByToken($token, $this->userId);
$participant = $room->getParticipant($this->userId);
if ($participant->getParticipantType() === Participant::USER_SELF_JOINED) {
$room->removeParticipantBySession($participant);
}
} catch (RoomNotFoundException $e) {
} catch (\RuntimeException $e) {
}
// As a pre-caution we simply disconnect the user from all rooms
$this->manager->disconnectUserFromAllRooms($this->userId);
} else {
$sessionId = $this->session->get('spreed-session');

Loading…
Cancel
Save