Changeset

1428:091ee76745e8

mod_muc_limits: Make compatible with new MUC API
author Vadim Misbakh-Soloviov <mva@mva.name>
date Sun, 01 Jun 2014 16:08:05 +0700
parents 1427:322a076f53e8
children 1429:3f85aaca8282
files mod_muc_limits/mod_muc_limits.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_limits/mod_muc_limits.lua	Sat May 31 13:38:35 2014 +0100
+++ b/mod_muc_limits/mod_muc_limits.lua	Sun Jun 01 16:08:05 2014 +0700
@@ -1,5 +1,6 @@
 
-if not hosts[module.host].modules.muc then
+local rooms = module:shared "muc/rooms";
+if not rooms then
 	module:log("error", "This module only works on MUC components!");
 	return;
 end
@@ -8,7 +9,6 @@
 local st = require "util.stanza";
 local new_throttle = require "util.throttle".create;
 local t_insert, t_concat = table.insert, table.concat;
-local hosts = prosody.hosts;
 
 local xmlns_muc = "http://jabber.org/protocol/muc";
 
@@ -31,7 +31,7 @@
 		return;
 	end
 	local dest_room, dest_host, dest_nick = jid_split(stanza.attr.to);
-	local room = hosts[module.host].modules.muc.rooms[dest_room.."@"..dest_host];
+	local room = rooms[dest_room.."@"..dest_host];
 	if not room then return; end
 	local from_jid = stanza.attr.from;
 	local occupant = room._occupants[room._jid_nick[from_jid]];
@@ -77,7 +77,7 @@
 end
 
 function module.unload()
-	for room_jid, room in pairs(hosts[module.host].modules.muc.rooms) do
+	for room_jid, room in pairs(rooms) do
 		room.throttle = nil;
 	end
 end