Skip to content

Commit

Permalink
fix(time_restricted): dont destroy a new room if it uses an old room …
Browse files Browse the repository at this point in the history
…name
  • Loading branch information
emrahcom committed Mar 22, 2024
1 parent 5ee3b19 commit 2ec3ed6
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions time_restricted/mod_time_restricted.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,28 @@ module:hook("muc-room-created", function (event)

-- announce the expiration time
room:broadcast_message(
st.message({ type="groupchat", from=room.jid })
:tag("body")
:text("The conference will be terminated in "..MIN.." min"))
st.message({ type="groupchat", from=room.jid })
:tag("body")
:text("The conference will be terminated in "..MIN.." min"))

module:log(LOGLEVEL, "set timeout for conference, %s secs, %s",
TIMEOUT, room.jid)
module:log(
LOGLEVEL, "set timeout for conference, %s secs, %s",
TIMEOUT,
room.jid
)

timer.add_task(TIMEOUT, function()
if is_healthcheck_room(room.jid) then
return
end

local occupant_count = it.count(room:each_occupant())
if occupant_count == 0 then
return
end

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

0 comments on commit 2ec3ed6

Please sign in to comment.