Comparison

plugins/muc/lock.lib.lua @ 7407:e465b584547b

MUC: Move the locked flag into persisted data (so not to lose it on eviction)
author Kim Alvefur <zash@zash.se>
date Thu, 28 Apr 2016 23:14:09 +0200
parent 6329:6b3eb1611587
child 7408:cf53081ce767
comparison
equal deleted inserted replaced
7406:92755ca737c3 7407:e465b584547b
12 local lock_rooms = module:get_option_boolean("muc_room_locking", false); 12 local lock_rooms = module:get_option_boolean("muc_room_locking", false);
13 local lock_room_timeout = module:get_option_number("muc_room_lock_timeout", 300); 13 local lock_room_timeout = module:get_option_number("muc_room_lock_timeout", 300);
14 14
15 local function lock(room) 15 local function lock(room)
16 module:fire_event("muc-room-locked", {room = room;}); 16 module:fire_event("muc-room-locked", {room = room;});
17 room.locked = true; 17 room._data.locked = true;
18 end 18 end
19 local function unlock(room) 19 local function unlock(room)
20 module:fire_event("muc-room-unlocked", {room = room;}); 20 module:fire_event("muc-room-unlocked", {room = room;});
21 room.locked = nil; 21 room._data.locked = nil;
22 end 22 end
23 local function is_locked(room) 23 local function is_locked(room)
24 return not not room.locked; 24 return not not room._data.locked;
25 end 25 end
26 26
27 if lock_rooms then 27 if lock_rooms then
28 module:hook("muc-room-pre-create", function(event) 28 module:hook("muc-room-pre-create", function(event)
29 -- Older groupchat protocol doesn't lock 29 -- Older groupchat protocol doesn't lock