From d7a999eaf5f5a10090ef5332dba84dacc5800c6c Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 19 Apr 2017 21:47:10 +0200 Subject: [PATCH] Don't use jid:from_string as it's deprecated, see jid.erl line 43 --- src/mod_muc_room.erl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index 426b28a4e..6869de6da 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -3746,13 +3746,16 @@ process_iq_mucsub(From, #iq{type = set, lang = Lang, StateData) when UnsubJid /= <<>> -> FAffiliation = get_affiliation(From, StateData), FRole = get_role(From, StateData), - if FRole == moderator; FAffiliation == owner; FAffiliation == admin -> - FromUnsub = jid:from_string(UnsubJid), + 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); - 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) -> -- 2.40.0