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

mod_muc_room: Replace deprecated function call

Use jid:decode/1 instead of jlib:string_to_jid/1.
This commit is contained in:
Holger Weiss 2017-04-11 13:38:33 +02:00
parent b1acd1183f
commit 87ae2d7996

View File

@ -242,14 +242,17 @@ muc_online_rooms(ServerHost) ->
end, Hosts). end, Hosts).
muc_register_nick(Nick, JIDBinary, Domain) -> muc_register_nick(Nick, JIDBinary, Domain) ->
JID = jlib:string_to_jid(JIDBinary), try jid:decode(JIDBinary) of
%{jid, UID, Host, _,_,_,_} = jlib:string_to_jid(JIDBinary), JID ->
F = fun (MHost, MNick) -> F = fun (MHost, MNick) ->
mnesia:write(#muc_registered{us_host=MHost, nick=MNick}) mnesia:write(#muc_registered{us_host=MHost, nick=MNick})
end, end,
case mnesia:transaction(F, [{{JID#jid.luser, JID#jid.lserver}, Domain}, Nick]) of case mnesia:transaction(F, [{{JID#jid.luser, JID#jid.lserver},
{atomic, ok} -> ok; Domain}, Nick]) of
{aborted, _Error} -> error {atomic, ok} -> ok;
{aborted, _Error} -> error
end
catch _:{bad_jid, _} -> throw({error, "Malformed JID"})
end. end.
muc_unregister_nick(Nick) -> muc_unregister_nick(Nick) ->