# HG changeset patch # User daurnimator # Date 1396467368 14400 # Node ID 49dd381666f3a1517c280010cdb0a7c0528803ee # Parent c3254827698d0151d8c7e21d6e0b754a86a09b12 plugins/muc/mod_muc: Move room locking into hook diff -r c3254827698d -r 49dd381666f3 plugins/muc/mod_muc.lua --- a/plugins/muc/mod_muc.lua Wed Apr 02 15:14:52 2014 -0400 +++ b/plugins/muc/mod_muc.lua Wed Apr 02 15:36:08 2014 -0400 @@ -90,7 +90,13 @@ 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 @@ end end); end - end - module:fire_event("muc-room-created", { room = room }); - return room; + end); end function forget_room(jid)