]> granicus.if.org Git - ejabberd/commitdiff
Don't use jid:from_string as it's deprecated, see jid.erl line 43
authorBadlop <badlop@process-one.net>
Wed, 19 Apr 2017 19:47:10 +0000 (21:47 +0200)
committerBadlop <badlop@process-one.net>
Wed, 19 Apr 2017 19:47:59 +0000 (21:47 +0200)
src/mod_muc_room.erl

index 426b28a4e587f97f0a44b21db46d8df79f0a33ed..6869de6dace341c17b60e81ab948123b8dbbdb93 100644 (file)
@@ -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) ->