diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-08-30 14:15:29 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-08-30 14:15:29 +0100 |
commit | 7371e649114de914d4a73ee7e2fe193243f4392e (patch) | |
tree | a07f2da515f036877b38fee05bf5991d0f29d5b4 /plugins/muc/mod_muc.lua | |
parent | 3b5a854ecd136a03377939bd03ea1f65eba541c7 (diff) | |
download | prosody-7371e649114de914d4a73ee7e2fe193243f4392e.tar.gz prosody-7371e649114de914d4a73ee7e2fe193243f4392e.zip |
mod_muc: Support for locking newly-created rooms until they are configured (enabled with muc_room_locking = true)
Diffstat (limited to 'plugins/muc/mod_muc.lua')
-rw-r--r-- | plugins/muc/mod_muc.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index f9b6ca58..cb967c90 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -23,6 +23,9 @@ if restrict_room_creation then restrict_room_creation = nil; end end +local lock_rooms = module:get_option_boolean("muc_room_locking", false); +local lock_room_timeout = module:get_option_number("muc_room_lock_timeout", 300); + local muclib = module:require "muc"; local muc_new_room = muclib.new_room; local jid_split = require "util.jid".split; @@ -88,6 +91,16 @@ function create_room(jid) room.route_stanza = room_route_stanza; room.save = room_save; rooms[jid] = room; + if lock_rooms then + room.locked = true; + if lock_room_timeout and lock_room_timeout > 0 then + module:add_timer(lock_room_timeout, function () + if room.locked then + room:destroy(); -- Not unlocked in time + end + end); + end + end module:fire_event("muc-room-created", { room = room }); return room; end |