Software /
code /
prosody-modules
Diff
mod_muc_limits/mod_muc_limits.lua @ 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 |
parent | 1205:7d2d440e2fa5 |
child | 1768:163967467308 |
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