ejabberd - Comments for "Looking for a simple IQ handler module template" https://www.ejabberd.im/node/5035 en I've improved it a little. It https://www.ejabberd.im/node/5035#comment-58036 <p>I've improved it a little. It works for me.</p> <pre>-module(mod_iqtest). -behaviour(gen_mod). -export([start/2, stop/1, process_sm_iq/3 %% I assume this is needed to handle JID to JID communication of the IQ? ]). -include("ejabberd.hrl"). -include("jlib.hrl"). -define(NS_TEST, "http://jabber.org/protocol/test"). -define(NS_TEST2, "http://jabber.org/protocol/test2"). start(Host, Opt) -&gt; IQDisc = gen_mod:get_opt(iqdisc, Opt, one_queue), gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_TEST, ?MODULE, process_sm_iq, IQDisc), gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_TEST2, ?MODULE, process_sm_iq, IQDisc), ?INFO_MSG("Loading module 'mod_iqtest' v.01", []). stop(Host) -&gt; gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_TEST), gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_TEST2), ?INFO_MSG("Stoping module 'mod_iqtest' ", []). process_sm_iq(_From, _To, #iq{type = get, xmlns = ?NS_TEST} = IQ) -&gt; ?INFO_MSG("Processing IQ Get query:~n ~p", [IQ]), IQ#iq{type = result, sub_el = [{xmlelement, "value", [], [{xmlcdata, "Hello World of Testing."}]}]}; process_sm_iq(_From, _To, #iq{type = get, xmlns = ?NS_TEST2} = IQ) -&gt; ?INFO_MSG("Processing IQ Get query of namespace 2:~n ~p", [IQ]), IQ#iq{type = result, sub_el = [{xmlelement, "value", [], [{xmlcdata, "Hello World of Test 2."}]}]}; process_sm_iq(_From, _To, #iq{type = set} = IQ) -&gt; ?INFO_MSG("Processing IQ Set: it does nothing", []), IQ#iq{type = result, sub_el = []}; process_sm_iq(_From, _To, #iq{sub_el = SubEl} = IQ) -&gt; ?INFO_MSG("Processing IQ other type: it does nothing", []), IQ#iq{type = error, sub_el = [SubEl, ?ERR_FEATURE_NOT_IMPLEMENTED]}. </pre> Tue, 15 Nov 2011 10:29:20 +0000 mfoss comment 58036 at https://www.ejabberd.im