From: Holger Weiss Date: Wed, 19 Apr 2017 20:18:23 +0000 (+0200) Subject: Use #jid{} type for #muc_unsubscribe.jid X-Git-Tag: 17.06-beta~133 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3adf720bc1df7f9e2a6d8372438d56bd0bbfd6b6;p=ejabberd Use #jid{} type for #muc_unsubscribe.jid --- diff --git a/rebar.config b/rebar.config index 05d5d29a2..181ce3ba4 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", "ad15e74e073a9cd230f31f657b395b1873227875"}}, + {xmpp, ".*", {git, "https://github.com/processone/xmpp", "806ac5e4ebfbcf1f8f5ebe5a8458ebb7e250d501"}}, {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 6869de6da..f93828962 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -3742,20 +3742,18 @@ process_iq_mucsub(From, add_new_user(From, Nick, Packet, SD2) end; process_iq_mucsub(From, #iq{type = set, lang = Lang, - sub_els = [#muc_unsubscribe{jid = UnsubJid}]}, - StateData) when UnsubJid /= <<>> -> + sub_els = [#muc_unsubscribe{jid = #jid{} = UnsubJid}]}, + StateData) -> FAffiliation = get_affiliation(From, StateData), FRole = get_role(From, StateData), - try jid:decode(UnsubJid) of - FromUnsub when FRole == moderator; FAffiliation == owner; FAffiliation == admin -> - process_iq_mucsub(FromUnsub, #iq{type = set, sub_els = [#muc_unsubscribe{jid = <<>>}]}, - StateData); - _ -> + if FRole == moderator; FAffiliation == owner; FAffiliation == admin -> + process_iq_mucsub(UnsubJid, + #iq{type = set, + sub_els = [#muc_unsubscribe{jid = undefined}]}, + StateData); + true -> Txt = <<"Moderator privileges required">>, {error, xmpp:err_forbidden(Txt, Lang)} - catch - error:{bad_jid,_} -> - {error, xmpp:err_jid_malformed()} end; process_iq_mucsub(From, #iq{type = set, sub_els = [#muc_unsubscribe{}]}, StateData) ->