aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-04-02 15:36:08 -0400
committerdaurnimator <quae@daurnimator.com>2014-04-02 15:36:08 -0400
commit905c1a9c37d76e0e5322fbfc9629bbf07aa81638 (patch)
tree5d49c11e26b0c0c93c2c0f29b72fa9f6e65f827b /plugins
parent5c2a128e96093068d94191fae472508108d43197 (diff)
downloadprosody-905c1a9c37d76e0e5322fbfc9629bbf07aa81638.tar.gz
prosody-905c1a9c37d76e0e5322fbfc9629bbf07aa81638.zip
plugins/muc/mod_muc: Move room locking into hook
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/mod_muc.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index a8a6388d..8b40d6ad 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -90,7 +90,13 @@ function create_room(jid)
local room = muc_new_room(jid);
room.save = room_save;
rooms[jid] = room;
- if lock_rooms then
+ module:fire_event("muc-room-created", { room = room });
+ return room;
+end
+
+if lock_rooms then
+ module:hook("muc-room-created", function(event)
+ local room = event.room;
room:lock();
if lock_room_timeout and lock_room_timeout > 0 then
module:add_timer(lock_room_timeout, function ()
@@ -99,9 +105,7 @@ function create_room(jid)
end
end);
end
- end
- module:fire_event("muc-room-created", { room = room });
- return room;
+ end);
end
function forget_room(jid)