# HG changeset patch # User Matthew Wild # Date 1370244960 -3600 # Node ID 5fd0860c86cdcdde15a21de671774e193a45d11f # Parent 7153b723fd87a74a4c482da6c3f1da7538c9d957 mod_muc_limits: Allow stanzas from affiliated users even if they are not in the room diff -r 7153b723fd87 -r 5fd0860c86cd mod_muc_limits/mod_muc_limits.lua --- a/mod_muc_limits/mod_muc_limits.lua Sun Jun 02 02:32:21 2013 +0200 +++ b/mod_muc_limits/mod_muc_limits.lua Mon Jun 03 08:36:00 2013 +0100 @@ -1,8 +1,9 @@ -local jid = require "util.jid"; +local jid_split, jid_bare = require "util.jid".split, require "util.jid".bare; 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"; @@ -24,12 +25,12 @@ if stanza.name == "presence" and stanza.attr.type == "unavailable" then -- Don't limit room leaving return; end - local dest_room, dest_host, dest_nick = jid.split(stanza.attr.to); + local dest_room, dest_host, dest_nick = jid_split(stanza.attr.to); local room = hosts[module.host].modules.muc.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]]; - if occupant and occupant.affiliation then + if (occupant and occupant.affiliation) or (not(occupant) and room._affiliations[jid_bare(from_jid)]) then module:log("debug", "Skipping stanza from affiliated user..."); return; elseif max_nick_length and stanza.name == "presence" and not room._occupants[stanza.attr.to] and #dest_nick > max_nick_length then