Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 7086:6cc7c9da29ed
MUC: Rename variables to please luacheck
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 20 Jan 2016 14:46:06 +0100 |
parent | 6800:ad231285efdd |
child | 7246:80923a1a8fe1 |
comparison
equal
deleted
inserted
replaced
7085:343be83ddfa6 | 7086:6cc7c9da29ed |
---|---|
11 end | 11 end |
12 | 12 |
13 local muclib = module:require "muc"; | 13 local muclib = module:require "muc"; |
14 room_mt = muclib.room_mt; -- Yes, global. | 14 room_mt = muclib.room_mt; -- Yes, global. |
15 | 15 |
16 local affiliation_notify = module:require "muc/affiliation_notify"; | 16 local affiliation_notify = module:require "muc/affiliation_notify"; -- luacheck: ignore 211 |
17 | 17 |
18 local name = module:require "muc/name"; | 18 local name = module:require "muc/name"; |
19 room_mt.get_name = name.get; | 19 room_mt.get_name = name.get; |
20 room_mt.set_name = name.set; | 20 room_mt.set_name = name.set; |
21 | 21 |
100 local function room_save(room, forced) | 100 local function room_save(room, forced) |
101 local node = jid_split(room.jid); | 101 local node = jid_split(room.jid); |
102 local is_persistent = persistent.get(room); | 102 local is_persistent = persistent.get(room); |
103 persistent_rooms:set(nil, room.jid, is_persistent); | 103 persistent_rooms:set(nil, room.jid, is_persistent); |
104 if is_persistent then | 104 if is_persistent then |
105 local history = room._data.history; | 105 local room_history = room._data.history; |
106 room._data.history = nil; | 106 room._data.history = nil; |
107 local data = { | 107 local data = { |
108 jid = room.jid; | 108 jid = room.jid; |
109 _data = room._data; | 109 _data = room._data; |
110 _affiliations = room._affiliations; | 110 _affiliations = room._affiliations; |
111 }; | 111 }; |
112 room_configs:set(node, data); | 112 room_configs:set(node, data); |
113 room._data.history = history; | 113 room._data.history = room_history; |
114 elseif forced then | 114 elseif forced then |
115 room_configs:set(node, nil); | 115 room_configs:set(node, nil); |
116 if not next(room._occupants) then -- Room empty | 116 if not next(room._occupants) then -- Room empty |
117 rooms[room.jid] = nil; | 117 rooms[room.jid] = nil; |
118 end | 118 end |
292 local destroy_rooms_handler = adhoc_initial(destroy_rooms_layout, function() | 292 local destroy_rooms_handler = adhoc_initial(destroy_rooms_layout, function() |
293 return { rooms = array.collect(each_room()):pluck("jid"):sort(); }; | 293 return { rooms = array.collect(each_room()):pluck("jid"):sort(); }; |
294 end, function(fields, errors) | 294 end, function(fields, errors) |
295 if errors then | 295 if errors then |
296 local errmsg = {}; | 296 local errmsg = {}; |
297 for name, err in pairs(errors) do | 297 for field, err in pairs(errors) do |
298 errmsg[#errmsg + 1] = name .. ": " .. err; | 298 errmsg[#errmsg + 1] = field .. ": " .. err; |
299 end | 299 end |
300 return { status = "completed", error = { message = t_concat(errmsg, "\n") } }; | 300 return { status = "completed", error = { message = t_concat(errmsg, "\n") } }; |
301 end | 301 end |
302 for _, room in ipairs(fields.rooms) do | 302 for _, room in ipairs(fields.rooms) do |
303 get_room_from_jid(room):destroy(); | 303 get_room_from_jid(room):destroy(); |