Skip to content

Commit

Permalink
fix(owner_restricted): dont destroy an active room if it uses an old …
Browse files Browse the repository at this point in the history
…room name
  • Loading branch information
emrahcom committed Mar 22, 2024
1 parent c605997 commit 276cd60
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions owner_restricted/mod_owner_restricted.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ local function terminator(room)
-- stop this terminator if there is another active one
-- always the last terminator destroys the room
if room._data.terminator_count > 0 then
module:log(
LOGLEVEL,
"there is another active terminator. this one is stopped, %s, %s",
room.jid, room._data.meetingId
)
return
end

-- stop this terminator if there is no one in the room
-- this happens if the room was already destroyed by another mechanism
local occupant_count = it.count(room:each_occupant())
if not (occupant_count > 0) then

Check warning on line 36 in owner_restricted/mod_owner_restricted.lua

View workflow job for this annotation

GitHub Actions / Luacheck

'not (x > y)' can be replaced by 'x <= y' (if neither side is a table or NaN)
module:log(
LOGLEVEL,
"Noone in the room, terminator is stopped, %s, %s",
room.jid, room._data.meetingId
)
return
end

Expand All @@ -41,6 +58,7 @@ local function terminator(room)
end

-- terminate the meeting
room:set_persistent(false)
room:destroy(nil, "The meeting has been terminated")
module:log(LOGLEVEL, "the meeting has been terminated")
end
Expand Down

0 comments on commit 276cd60

Please sign in to comment.