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
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-05 17:24:17 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-06-08 15:55:03 +0300
commitef39f6fc82aaaa860a79a5ef48fa7bb81d5b05e2 (patch)
tree12cc7f34a02621239dd6d6912e7cefe8b7d07b01 /lib
parent9d965729ac36bfee2e479d5f619ced9ad4b19a12 (diff)
Bring back session expiration
It was dropped wih Room v2 API after the participant list was dropped completly there Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/RoomController.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index b9f055129..956b9f5b9 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -843,10 +843,15 @@ class RoomController extends AEnvironmentAwareController {
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
+ $maxPingAge = $this->timeFactory->getTime() - 100;
$participants = $this->room->getParticipantsLegacy();
$results = [];
foreach ($participants['users'] as $userId => $participant) {
+ if ($participant['sessionId'] !== '0' && $participant['lastPing'] <= $maxPingAge) {
+ $this->room->leaveRoom($userId);
+ }
+
$user = $this->userManager->get((string) $userId);
if (!$user instanceof IUser) {
continue;
@@ -864,7 +869,12 @@ class RoomController extends AEnvironmentAwareController {
}
$guestNames = $this->guestManager->getNamesBySessionHashes($guestSessions);
+ $cleanGuests = false;
foreach ($participants['guests'] as $participant) {
+ if ($participant['lastPing'] <= $maxPingAge) {
+ $cleanGuests = true;
+ }
+
$sessionHash = sha1($participant['sessionId']);
$results[] = array_merge($participant, [
'userId' => '',
@@ -872,6 +882,10 @@ class RoomController extends AEnvironmentAwareController {
]);
}
+ if ($cleanGuests) {
+ $this->room->cleanGuestParticipants();
+ }
+
return new DataResponse($results);
}