IQ interceptor not working for Resource

I tried to implement a custom IQ interceptor which is working is i don't add resource to JID but it doesn't work if resource is added.

PFA - mod_filter

-module(mod_filter).
-behaviour(gen_mod).

-export([start/2, stop/1,
process_sm_iq/3
]).

-include("ejabberd.hrl").
-include("logger.hrl").
-include("jlib.hrl").

-define(NS_TEST, <<"urn:xmpp:tmp:profile">>).

start(Host, Opt) ->
%%IQDisc = gen_mod:get_opt(iqdisc, Opt, one_queue),
IQDisc = gen_mod:get_opt(iqdisc, Opt, fun gen_iq_handler:check_type/1,
one_queue),
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_TEST, ?MODULE, process_sm_iq, IQDisc).
%% ?INFO_MSG("Loading module 'mod_iqtest' v.01", []).

stop(Host) ->
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_TEST).
%%?INFO_MSG("Stoping module 'mod_iqtest' ", [])

process_sm_iq(_From, _To, #iq{type = get, xmlns = ?NS_TEST} = IQ) ->
%%?INFO_MSG("----------------------Processing IQ Get query:~n ~p", [IQ]).
send_message(_From,_To),
IQ#iq{type = result,sub_el = [{xmlcdata,<<"Hello world of testing">>}]};
process_sm_iq(_From, _To, #iq{type = set} = IQ) ->
%%?INFO_MSG("----------------------Processing IQ Set: it does nothing", []),
IQ#iq{type = result, sub_el = []};
process_sm_iq(_From, _To, #iq{sub_el = SubEl} = IQ) ->
%% ?INFO_MSG("----------------------Processing IQ other type: it does nothing", []),
IQ#iq{type = error, sub_el = [SubEl, ?ERR_FEATURE_NOT_IMPLEMENTED]}.

Syndicate content