diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2017-04-19 22:18:23 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2017-04-19 22:18:23 +0200 |
commit | 3adf720bc1df7f9e2a6d8372438d56bd0bbfd6b6 (patch) | |
tree | 2768fb355559a637c556a3b3dbf7568404c9ec2e /src/mod_muc_room.erl | |
parent | Don't use jid:from_string as it's deprecated, see jid.erl line 43 (diff) |
Use #jid{} type for #muc_unsubscribe.jid
Diffstat (limited to 'src/mod_muc_room.erl')
-rw-r--r-- | src/mod_muc_room.erl | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index 6869de6d..f9382896 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) -> |