summaryrefslogtreecommitdiff
path: root/src/mod_muc_room.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2017-04-19 21:47:10 +0200
committerBadlop <badlop@process-one.net>2017-04-19 21:47:59 +0200
commitd7a999eaf5f5a10090ef5332dba84dacc5800c6c (patch)
tree1081f062d7c180f7ebf47d89e5070c4a24c643d2 /src/mod_muc_room.erl
parentDon't try to load already loaded applications (diff)
Don't use jid:from_string as it's deprecated, see jid.erl line 43
Diffstat (limited to 'src/mod_muc_room.erl')
-rw-r--r--src/mod_muc_room.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl
index 426b28a4..6869de6d 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) ->