aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/lock.lib.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-05-23 20:37:16 +0100
committerMatthew Wild <mwild1@gmail.com>2014-05-23 20:37:16 +0100
commitb5a72ce69dcaa31dc6e626956144c579c04fdc72 (patch)
tree3f5de516b7b87f9a82f26861db6700c2a0320540 /plugins/muc/lock.lib.lua
parent9680214e3d4d8d853e83bbdb357601673dd6f2f6 (diff)
parent9e8f0a984c05647db2346160d1cf62139560fefc (diff)
downloadprosody-b5a72ce69dcaa31dc6e626956144c579c04fdc72.tar.gz
prosody-b5a72ce69dcaa31dc6e626956144c579c04fdc72.zip
Merge with daurnimator
Diffstat (limited to 'plugins/muc/lock.lib.lua')
-rw-r--r--plugins/muc/lock.lib.lua14
1 files changed, 5 insertions, 9 deletions
diff --git a/plugins/muc/lock.lib.lua b/plugins/muc/lock.lib.lua
index 7cf19be3..319a6973 100644
--- a/plugins/muc/lock.lib.lua
+++ b/plugins/muc/lock.lib.lua
@@ -23,7 +23,10 @@ local function is_locked(room)
end
if lock_rooms then
- module:hook("muc-room-created", function(event)
+ module:hook("muc-room-pre-create", function(event)
+ -- Older groupchat protocol doesn't lock
+ if not event.stanza:get_child("x", "http://jabber.org/protocol/muc") then return end
+ -- Lock room at creation
local room = event.room;
lock(room);
if lock_room_timeout and lock_room_timeout > 0 then
@@ -33,16 +36,9 @@ if lock_rooms then
end
end);
end
- end);
+ end, 10);
end
--- Older groupchat protocol doesn't lock
-module:hook("muc-room-pre-create", function(event)
- if is_locked(event.room) and not event.stanza:get_child("x", "http://jabber.org/protocol/muc") then
- unlock(event.room);
- end
-end, 10);
-
-- Don't let users into room while it is locked
module:hook("muc-occupant-pre-join", function(event)
if not event.is_new_room and is_locked(event.room) then -- Deny entry