# HG changeset patch # User Vadim Misbakh-Soloviov # Date 1401613685 -25200 # Node ID 091ee76745e8d02a1f0f57982dd2f47088a89277 # Parent 322a076f53e8919c2c6684a1db7086f349703207 mod_muc_limits: Make compatible with new MUC API diff -r 322a076f53e8 -r 091ee76745e8 mod_muc_limits/mod_muc_limits.lua --- 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