diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2018-06-14 19:49:27 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2018-06-14 19:49:27 +0300 |
commit | 17b05ff4b733089f0118768b941497fc5a92d8bf (patch) | |
tree | 8e63651689b78d19a8fd9ccd06294f925c8450f7 | |
parent | Update mod_muc_room.hrl (diff) |
Get rid of all calls to jlib.erl module
-rw-r--r-- | src/gen_iq_handler.erl | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/src/gen_iq_handler.erl b/src/gen_iq_handler.erl index 9568b1ccd..34b20fc8b 100644 --- a/src/gen_iq_handler.erl +++ b/src/gen_iq_handler.erl @@ -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", []), |