From 9a20f1576918844a528546aac42e643bcb11c327 Mon Sep 17 00:00:00 2001 From: emrah Date: Thu, 25 Apr 2024 17:11:58 +0300 Subject: [PATCH] fix(lobby_deactivate): dont run for focus --- lobby_deactivate/mod_lobby_deactivate.lua | 25 +++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lobby_deactivate/mod_lobby_deactivate.lua b/lobby_deactivate/mod_lobby_deactivate.lua index b4afdd1..285ce11 100644 --- a/lobby_deactivate/mod_lobby_deactivate.lua +++ b/lobby_deactivate/mod_lobby_deactivate.lua @@ -3,17 +3,24 @@ --- This module should be added to the main muc component. --- -local LOGLEVEL = "debug"; +local LOGLEVEL = "debug" -local is_healthcheck_room = module:require "util".is_healthcheck_room; +local it = require "util.iterators" +local is_healthcheck_room = module:require "util".is_healthcheck_room -module:log("info", "loaded"); +module:log("info", "loaded") module:hook("muc-occupant-joined", function (event) - local room, origin = event.room, event.origin; + local room, origin = event.room, event.origin if is_healthcheck_room(room.jid) then - return; + return + end + + -- do run for focus + local occupant_count = it.count(room:each_occupant()) + if occupant_count < 2 then + return end -- do nothing if already checked @@ -22,21 +29,21 @@ module:hook("muc-occupant-joined", function (event) end room._data.lobby_deactivated = true - -- do nothing if the lobby is not activate + -- do nothing if the lobby is not active if room._data.lobbyroom == nil then module:log(LOGLEVEL, "no active lobby - %s", room.jid) return end -- deactivate the lobby if it is not enabled explicitly - local context_room = origin.jitsi_meet_context_room; + local context_room = origin.jitsi_meet_context_room if not context_room or context_room["lobby"] ~= true then room:set_members_only(false) prosody.events.fire_event('destroy-lobby-room', { room = room, newjid = room.jid, - }); + }) end -end, -2); +end, -2) --- Run just before lobby_bypass (priority -3), lobby(-4) and members_only (-5). --- Must run after token_verification (99), max_occupants (10), allowners (2).