ejabberd - Comments for "Handling custom IQs" https://www.ejabberd.im/forum/25354/handling-custom-iqs en That code was for ejabberd 2. https://www.ejabberd.im/forum/25354/handling-custom-iqs#comment-66600 <p>That code was for ejabberd 2. In recent ejabberd, I have to make some changes to your code:</p> <pre> --- a/src/mod_iqtest.erl +++ b/src/mod_iqtest.erl @@ -13,7 +13,7 @@ -include("jlib.hrl"). -include("logger.hrl"). --define(NS_TEST, "http://jabber.org/protocol/test"). +-define(NS_TEST, &lt;&lt;"http://jabber.org/protocol/test"&gt;&gt;). -define(NS_TEST2, "http://jabber.org/protocol/test2"). start(Host, Opts) -&gt; @@ -22,7 +22,7 @@ start(Host, Opts) -&gt; ok. init(Host, _Opts) -&gt; - IQDisc = gen_mod:get_opt(iqdisc, _Opts, one_queue), + IQDisc = gen_mod:get_opt(iqdisc, _Opts, fun(A) -&gt; A end, 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("added iq handlers 'mod_iqtest' v.01", []), @@ -36,4 +36,4 @@ stop(Host) -&gt; process_sm_iq(_From, _To, IQ) -&gt; ?INFO_MSG("Processing IQ Get query:~n ~p", [IQ]), - IQ#iq{type = result, sub_el = [{xmlelement, "value", [], [{xmlcdata, "Hello World of Testing."}]}]}. + IQ#iq{type = result, sub_el = [{xmlel, &lt;&lt;"value"&gt;&gt;, [], [{xmlcdata, &lt;&lt;"Hello World of Testing."&gt;&gt;}]}]}. </pre><p> Then I send a proper IQ request and works:</p> <div class="codeblock"><code>&lt;iq type=&#039;get&#039;&gt;<br />&nbsp; &lt;query xmlns=&#039;http://jabber.org/protocol/test&#039;/&gt;<br />&lt;/iq&gt; <p>&lt;iq from=&#039;user1@localhost&#039; to=&#039;user1@localhost/tka1&#039; type=&#039;result&#039;&gt;<br />&nbsp; &lt;value&gt;Hello World of Testing.&lt;/value&gt;<br />&lt;/iq&gt;</p></code></div> Wed, 24 Feb 2016 18:57:35 +0000 badlop comment 66600 at https://www.ejabberd.im Any idea guys? Should it work https://www.ejabberd.im/forum/25354/handling-custom-iqs#comment-66596 <p>Any idea guys? Should it work as is?</p> Wed, 24 Feb 2016 08:39:11 +0000 adambenayoun comment 66596 at https://www.ejabberd.im