Comparison

plugins/muc/muc.lib.lua @ 3611:d58da6bb8a77

MUC: Grant membership when inviteing someone into a members-only room.
author Kim Alvefur <zash@zash.se>
date Thu, 11 Nov 2010 00:55:33 +0100
parent 3593:58a4af582eb3
child 3629:856e42b38bb0
comparison
equal deleted inserted replaced
3610:2084959d4096 3611:d58da6bb8a77
864 :text(_reason or "") 864 :text(_reason or "")
865 :up() 865 :up()
866 :tag('body') -- Add a plain message for clients which don't support invites 866 :tag('body') -- Add a plain message for clients which don't support invites
867 :text(_from..' invited you to the room '.._to..(_reason and (' ('.._reason..')') or "")) 867 :text(_from..' invited you to the room '.._to..(_reason and (' ('.._reason..')') or ""))
868 :up(); 868 :up();
869 if self:is_members_only() and not self:get_affiliation(_invitee) then
870 log("debug", "%s invited %s into members only room %s, granting membership", _from, _invitee, _to);
871 self:set_affiliation(_from, _invitee, "member", nil, "Invited by " .. self._jid_nick[_from])
872 end
869 self:_route_stanza(invite); 873 self:_route_stanza(invite);
870 else 874 else
871 origin.send(st.error_reply(stanza, "cancel", "jid-malformed")); 875 origin.send(st.error_reply(stanza, "cancel", "jid-malformed"));
872 end 876 end
873 else 877 else