[ejabberd] Can someone tell me what am I doing wrong?

Santiago Ignacio Poli santiago at etermax.com
Thu Apr 30 17:12:07 MSK 2015


Hi Mathias,

With the code you provided, I get:

11:08:33.826 [error] gen_server <0.467.0> terminated with reason: no
function clause matching
jlib:iq_to_xml({xmlel,<<"iq">>,[{<<"id">>,<<"test1">>},{<<"type">>,<<"result">>}],[{xmlel,<<"query">>,[{<<"xml...">>,...},...],...}]})
line 455
11:08:33.826 [error] CRASH REPORT Process <0.467.0> with 0 neighbours
exited with reason: no function clause matching
jlib:iq_to_xml({xmlel,<<"iq">>,[{<<"id">>,<<"test1">>},{<<"type">>,<<"result">>}],[{xmlel,<<"query">>,[{<<"xml...">>,...},...],...}]})
line 455 in gen_server:terminate/6 line 737
11:08:33.826 [error] Supervisor ejabberd_iq_sup had child undefined started
with {gen_iq_handler,start_link,undefined} at <0.467.0> exit with reason no
function clause matching
jlib:iq_to_xml({xmlel,<<"iq">>,[{<<"id">>,<<"test1">>},{<<"type">>,<<"result">>}],[{xmlel,<<"query">>,[{<<"xml...">>,...},...],...}]})
line 455 in context child_terminated

So I think the function has to return an IQ record, not an XML. It's very
weird because I'm comparing my code with other iq handlers (*mod_last *for
example) and can't figure out what am I doing wrong

Thanks!

2015-04-30 11:05 GMT-03:00 Matthias Rieber <ml-erlang at zu-con.org>:

> Hi,
>
> Am 2015-04-30 15:09, schrieb Santiago Ignacio Poli:
>
>  Recently I've been trying to implement my own IQ Handlers in ejabberd.
>> I've been using the hook mechanism for some time now but I think IQ
>> Handlers are more suitable for the features I need to implement.
>>
>> I've made a simple IQ handler to learn how to do this and encountered a
>> problem: Every time I send my custom IQ from my client, ejabberd throws
>> this exception (and don't return anything to the client):
>>
>>
> I'm not sure, maybe you need to return an #xmlel{} try:
>
> process_local_iq(From,_ ,IQ) ->
>     User = From#jid.luser,
>     error_logger:error_msg("User: ~s", [User]),
>     jlib:iq_to_xml(IQ#iq{type = result,
>       sub_el =
>         [#xmlel{
>          name = <<"query">>,
>          attrs = [{<<"xmlns">>, ?IQ_CUSTOM}, {<<"test">>,1}],
>          children = []
>      }]
>    }).
>
> Matthias
>
>


-- 
*Santiago Ignacio Poli*
*Java Developer **@etermax*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20150430/5ad3b41b/attachment.html>


More information about the ejabberd mailing list