diff options
author | daurnimator <quae@daurnimator.com> | 2014-10-15 16:56:42 -0400 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2014-10-15 16:56:42 -0400 |
commit | 68c29f3629e3c642ba41735f74ec6e05e383987f (patch) | |
tree | 1e2de0e7d0e1def212dac98fda14fb81d868c405 | |
parent | 2d7ee5e98605ef239bcf9042606015d6fef3b90d (diff) | |
download | prosody-68c29f3629e3c642ba41735f74ec6e05e383987f.tar.gz prosody-68c29f3629e3c642ba41735f74ec6e05e383987f.zip |
plugins/muc/muc.lib: Kick users from outcast hosts
-rw-r--r-- | plugins/muc/muc.lib.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 19614e82..bdf67df8 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -17,6 +17,7 @@ local iterators = require "util.iterators"; local jid_split = require "util.jid".split; local jid_bare = require "util.jid".bare; local jid_prep = require "util.jid".prep; +local jid_join = require "util.jid".join; local st = require "util.stanza"; local log = require "util.logger".init("mod_muc"); local base64 = require "util.encodings".base64; @@ -990,7 +991,10 @@ end function room_mt:set_affiliation(actor, jid, affiliation, reason) if not actor then return nil, "modify", "not-acceptable"; end; - jid = jid_bare(jid); + local node, host, resource = jid_split(jid); + if not host then return nil, "modify", "not-acceptable"; end + jid = jid_join(node, host); -- Bare + local is_host_only = node == nil; if valid_affiliations[affiliation or "none"] == nil then return nil, "modify", "not-acceptable"; @@ -1030,7 +1034,10 @@ function room_mt:set_affiliation(actor, jid, affiliation, reason) local role_rank = valid_roles[role or "none"]; local occupants_updated = {}; -- Filled with old roles for nick, occupant in self:each_occupant() do - if occupant.bare_jid == jid then + if occupant.bare_jid == jid or ( + -- Outcast can be by host. + is_host_only and affiliation == "outcast" and select(2, jid_split(occupant.bare_jid)) == host + ) then -- need to publcize in all cases; as affiliation in <item/> has changed. occupants_updated[occupant] = occupant.role; if occupant.role ~= role and ( |