From b010a1a0a03fb304ad018b4d42d69df93ca4c5a1 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 17 Oct 2018 12:55:31 +0200 Subject: [PATCH] Affiliations other than admin and owner cannot invite to members_only rooms This is explained in the paragraph: If the room is members-only, the service MAY also add the invitee to the member list. (Note: Invitation privileges in members-only rooms SHOULD be restricted to room admins; if a member without privileges to edit the member list attempts to invite another user, the service SHOULD return a error to the occupant; for details, see the Modifying the Member List section of this document.) https://xmpp.org/extensions/xep-0045.html#invite-mediated --- src/mod_muc_room.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index a7089bc10..267514b20 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -4217,7 +4217,8 @@ send_voice_request(From, Lang, StateData) -> ok | {error, stanza_error()}. check_invitation(From, Invitations, Lang, StateData) -> FAffiliation = get_affiliation(From, StateData), - CanInvite = (StateData#state.config)#config.allow_user_invites orelse + CanInvite = ((StateData#state.config)#config.allow_user_invites + and not (StateData#state.config)#config.members_only) orelse FAffiliation == admin orelse FAffiliation == owner, case CanInvite of true -> -- 2.40.0