25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Use #jid{} type for #muc_unsubscribe.jid

This commit is contained in:
Holger Weiss 2017-04-19 22:18:23 +02:00
parent d7a999eaf5
commit 3adf720bc1
2 changed files with 9 additions and 11 deletions

View File

@ -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"}}},

View File

@ -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) ->