diff --git a/rebar.config b/rebar.config index 71eebf6a9..8b1454de9 100644 --- a/rebar.config +++ b/rebar.config @@ -24,7 +24,7 @@ {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.11"}}}, {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.8"}}}, {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}}, - {xmpp, ".*", {git, "https://github.com/processone/xmpp", "806ac5e4ebfbcf1f8f5ebe5a8458ebb7e250d501"}}, + {xmpp, ".*", {git, "https://github.com/processone/xmpp", "e8dbfec277e7eb27b8130b13873b969cc346fafc"}}, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.10"}}}, {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.11"}}}, {fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.9"}}}, diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index f93828962..ca5b12925 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -3711,6 +3711,21 @@ process_iq_mucsub(_From, #iq{type = set, lang = Lang, sub_els = [#muc_subscribe{}]}, #state{just_created = false, config = #config{allow_subscription = false}}) -> {error, xmpp:err_not_allowed(<<"Subscriptions are not allowed">>, Lang)}; +process_iq_mucsub(From, + #iq{type = set, lang = Lang, + sub_els = [#muc_subscribe{jid = #jid{} = SubJid} = Mucsub]}, + StateData) -> + FAffiliation = get_affiliation(From, StateData), + FRole = get_role(From, StateData), + if FRole == moderator; FAffiliation == owner; FAffiliation == admin -> + process_iq_mucsub(SubJid, + #iq{type = set, lang = Lang, + sub_els = [Mucsub#muc_subscribe{jid = undefined}]}, + StateData); + true -> + Txt = <<"Moderator privileges required">>, + {error, xmpp:err_forbidden(Txt, Lang)} + end; process_iq_mucsub(From, #iq{type = set, lang = Lang, sub_els = [#muc_subscribe{nick = Nick}]} = Packet, @@ -3748,7 +3763,7 @@ process_iq_mucsub(From, #iq{type = set, lang = Lang, FRole = get_role(From, StateData), if FRole == moderator; FAffiliation == owner; FAffiliation == admin -> process_iq_mucsub(UnsubJid, - #iq{type = set, + #iq{type = set, lang = Lang, sub_els = [#muc_unsubscribe{jid = undefined}]}, StateData); true ->