Comparison

plugins/muc/mod_muc.lua @ 5016:56a0b13a3d42

mod_muc: Remove unused variable and pull hosts into a local
author Kim Alvefur <zash@zash.se>
date Thu, 26 Jul 2012 04:45:22 +0200
parent 5015:f19b38bfa015
child 5058:433cc9a4c7e9
comparison
equal deleted inserted replaced
5015:f19b38bfa015 5016:56a0b13a3d42
27 local jid_bare = require "util.jid".bare; 27 local jid_bare = require "util.jid".bare;
28 local st = require "util.stanza"; 28 local st = require "util.stanza";
29 local uuid_gen = require "util.uuid".generate; 29 local uuid_gen = require "util.uuid".generate;
30 local datamanager = require "util.datamanager"; 30 local datamanager = require "util.datamanager";
31 local um_is_admin = require "core.usermanager".is_admin; 31 local um_is_admin = require "core.usermanager".is_admin;
32 local hosts = hosts;
32 33
33 rooms = {}; 34 rooms = {};
34 local rooms = rooms; 35 local rooms = rooms;
35 local persistent_rooms = datamanager.load(nil, muc_host, "persistent") or {}; 36 local persistent_rooms = datamanager.load(nil, muc_host, "persistent") or {};
36 local component = hosts[module.host];
37 37
38 -- Configurable options 38 -- Configurable options
39 local max_history_messages = module:get_option_number("max_history_messages"); 39 local max_history_messages = module:get_option_number("max_history_messages");
40 40
41 local function is_admin(jid) 41 local function is_admin(jid)
170 if stanza.attr.type == "result" or stanza.attr.type == "error" then 170 if stanza.attr.type == "result" or stanza.attr.type == "error" then
171 module:send(stanza); 171 module:send(stanza);
172 else error("component.send only supports result and error stanzas at the moment"); end 172 else error("component.send only supports result and error stanzas at the moment"); end
173 end 173 end
174 174
175 prosody.hosts[module:get_host()].muc = { rooms = rooms }; 175 hosts[module:get_host()].muc = { rooms = rooms };
176 176
177 module.save = function() 177 module.save = function()
178 return {rooms = rooms}; 178 return {rooms = rooms};
179 end 179 end
180 module.restore = function(data) 180 module.restore = function(data)
186 room._affiliations = oldroom._affiliations; 186 room._affiliations = oldroom._affiliations;
187 room.route_stanza = room_route_stanza; 187 room.route_stanza = room_route_stanza;
188 room.save = room_save; 188 room.save = room_save;
189 rooms[jid] = room; 189 rooms[jid] = room;
190 end 190 end
191 prosody.hosts[module:get_host()].muc = { rooms = rooms }; 191 hosts[module:get_host()].muc = { rooms = rooms };
192 end 192 end