Diff

plugins/muc/mod_muc.lua @ 6206:f937bb5c83c3

plugins/muc: Move locking to seperate module
author daurnimator <quae@daurnimator.com>
date Wed, 02 Apr 2014 15:48:25 -0400
parent 6205:49dd381666f3
child 6222:355b29881117
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Wed Apr 02 15:36:08 2014 -0400
+++ b/plugins/muc/mod_muc.lua	Wed Apr 02 15:48:25 2014 -0400
@@ -23,8 +23,6 @@
 		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;
@@ -47,6 +45,7 @@
 module:add_identity("conference", "text", muc_name);
 module:add_feature("http://jabber.org/protocol/muc");
 module:depends "muc_unique"
+module:require "muc/lock";
 
 local function is_admin(jid)
 	return um_is_admin(jid, module.host);
@@ -94,20 +93,6 @@
 	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 ()
-				if room:is_locked() then
-					room:destroy(); -- Not unlocked in time
-				end
-			end);
-		end
-	end);
-end
-
 function forget_room(jid)
 	rooms[jid] = nil;
 end