25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +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).
muc_register_nick(Nick, JIDBinary, Domain) ->
JID = jlib:string_to_jid(JIDBinary),
%{jid, UID, Host, _,_,_,_} = jlib:string_to_jid(JIDBinary),
F = fun (MHost, MNick) ->
mnesia:write(#muc_registered{us_host=MHost, nick=MNick})
end,
case mnesia:transaction(F, [{{JID#jid.luser, JID#jid.lserver}, Domain}, Nick]) of
{atomic, ok} -> ok;
{aborted, _Error} -> error
try jid:decode(JIDBinary) of
JID ->
F = fun (MHost, MNick) ->
mnesia:write(#muc_registered{us_host=MHost, nick=MNick})
end,
case mnesia:transaction(F, [{{JID#jid.luser, JID#jid.lserver},
Domain}, Nick]) of
{atomic, ok} -> ok;
{aborted, _Error} -> error
end
catch _:{bad_jid, _} -> throw({error, "Malformed JID"})
end.
muc_unregister_nick(Nick) ->