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

Get rid of all calls to jlib.erl module

This commit is contained in:
Evgeniy Khramtsov 2018-06-14 19:49:27 +03:00
parent 7bd5c7fe59
commit 17b05ff4b7

View File

@ -107,21 +107,11 @@ get_features(_, _, _, XMLNSs) ->
-spec process_iq(binary(), atom(), atom(), iq()) -> any().
process_iq(_Host, Module, Function, IQ) ->
try
ResIQ = case erlang:function_exported(Module, Function, 1) of
true ->
process_iq(Module, Function, IQ);
false ->
From = xmpp:get_from(IQ),
To = xmpp:get_to(IQ),
process_iq(Module, Function, From, To,
jlib:iq_query_info(xmpp:encode(IQ)))
end,
if ResIQ /= ignore ->
ejabberd_router:route(ResIQ);
true ->
ok
end
try process_iq(Module, Function, IQ) of
#iq{} = ResIQ ->
ejabberd_router:route(ResIQ);
ignore ->
ok
catch E:R ->
?ERROR_MSG("failed to process iq:~n~s~nReason = ~p",
[xmpp:pp(IQ), {E, {R, erlang:get_stacktrace()}}]),
@ -143,16 +133,6 @@ process_iq(Module, Function, #iq{lang = Lang, sub_els = [El]} = IQ) ->
xmpp:make_error(IQ, xmpp:err_bad_request(Txt, Lang))
end.
-spec process_iq(module(), atom(), jid(), jid(), term()) -> iq().
process_iq(Module, Function, From, To, IQ) ->
case Module:Function(From, To, IQ) of
ignore -> ignore;
ResIQ ->
xmpp:set_from_to(
xmpp:decode(jlib:iq_to_xml(ResIQ), ?NS_CLIENT, [ignore_els]),
To, From)
end.
-spec check_type(any()) -> no_queue.
check_type(_Type) ->
?WARNING_MSG("Option 'iqdisc' is deprecated and has no effect anymore", []),