aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2010-11-11 00:55:33 +0100
committerKim Alvefur <zash@zash.se>2010-11-11 00:55:33 +0100
commite982b671520277be7717108520c77ced0d5b31c1 (patch)
treea92e58e9dfb6062f895123d124dad9a597abfe65 /plugins
parenta7d5c56e52fbfa28d31e1aac3a2ddddc7103c846 (diff)
downloadprosody-e982b671520277be7717108520c77ced0d5b31c1.tar.gz
prosody-e982b671520277be7717108520c77ced0d5b31c1.zip
MUC: Grant membership when inviteing someone into a members-only room.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index a1774117..d89f3efe 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -866,6 +866,10 @@ function room_mt:handle_to_room(origin, stanza) -- presence changes and groupcha
:tag('body') -- Add a plain message for clients which don't support invites
:text(_from..' invited you to the room '.._to..(_reason and (' ('.._reason..')') or ""))
:up();
+ if self:is_members_only() and not self:get_affiliation(_invitee) then
+ log("debug", "%s invited %s into members only room %s, granting membership", _from, _invitee, _to);
+ self:set_affiliation(_from, _invitee, "member", nil, "Invited by " .. self._jid_nick[_from])
+ end
self:_route_stanza(invite);
else
origin.send(st.error_reply(stanza, "cancel", "jid-malformed"));