MUC: Grant membership when inviteing someone into a members-only room.

Thu, 11 Nov 2010 00:55:33 +0100

author
Kim Alvefur <zash@zash.se>
date
Thu, 11 Nov 2010 00:55:33 +0100
changeset 3611
d58da6bb8a77
parent 3610
2084959d4096
child 3612
5547acd18a9f

MUC: Grant membership when inviteing someone into a members-only room.

plugins/muc/muc.lib.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/muc.lib.lua	Wed Nov 10 19:50:07 2010 +0000
+++ b/plugins/muc/muc.lib.lua	Thu Nov 11 00:55:33 2010 +0100
@@ -866,6 +866,10 @@
 					: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"));

mercurial