Daha önce ejabberd 2.1.10'daki hata ayıklama satırı için xml: get_tag_attr_s ("type", Packet) kullanıyordum, ancak bu artık ejabberd 13.03'te çalışmıyor. Muhtemelen dokümanlar (http://www.process-one.net/docs/exmpp/devdoc/trunk/xml.html#get_attr_s-2) uyarınca kullanımdan kaldırıldığı için exmpp kitaplığından bir işlev kullanmayı denedim.exmpp işlevi kullanılırken işlev hatası hatası
Ben ikinci DEBUG satırında bir hata alıyorum (İlk ayıklama hattı çalışıyor). Ve fikirler, değerden nasıl elde edilir?
Kod alıntı:
on_user_send_packet(From, To, Packet) ->
?DEBUG("Sent packet (1): ~p", [Packet]),
Type = exmpp_xml:get_attribute(Packet, <<"type">>, <<"unknown">>),
?DEBUG("Sent packet from (2): ~p", [From]),
Giriş: eleman adı, nitelikleri ve alt öğeler:
=INFO REPORT==== 2013-05-25 09:58:50 ===
D(<0.1625.0>:mod_stanza_ack:59) : Sent packet (1): {xmlel,<<"message">>,
[{<<"to">>,
<<"[email protected]_dev">>},
{<<"from">>,
<<"[email protected]_dev/webapp">>},
{<<"type">>,<<"chat">>},
{<<"id">>,<<"4834">>}],
[{xmlel,<<"body">>,[],
[{xmlcdata,
<<"SHOOOOOT">>}]},
{xmlel,<<"request">>,
[{<<"xmlns">>,
<<"urn:xmpp:receipts">>}],
[]}]}
=ERROR REPORT==== 2013-05-25 09:58:50 ===
E(<0.1625.0>:ejabberd_hooks:315) : {function_clause,
[{exmpp_xml,get_attribute,
[{xmlel,<<"message">>,
[{<<"to">>,
<<"[email protected]_dev">>},
{<<"from">>,
<<"[email protected]_dev/webapp">>},
{<<"type">>,<<"chat">>},
{<<"id">>,<<"4834">>}],
[{xmlel,<<"body">>,[],
[{xmlcdata,<<"SHOOOOOT">>}]},
{xmlel,<<"request">>,
[{<<"xmlns">>,
<<"urn:xmpp:receipts">>}],
[]}]},
<<"from">>,<<"unknown">>],
[{file,"./core/exmpp_xml.erl"},
{line,1173}]},
{mod_stanza_ack,on_user_send_packet,3,
[{file,"mod_stanza_ack.erl"},{line,60}]},
{ejabberd_hooks,run1,3,
[{file,"ejabberd_hooks.erl"},
{line,311}]},
{ejabberd_c2s,session_established2,2,
[{file,"ejabberd_c2s.erl"},{line,1136}]},
{p1_fsm,handle_msg,10,
[{file,"p1_fsm.erl"},{line,578}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
Haklısınız. xml: ejabberd 13.xx için çalışmak amacıyla (Paket><<"type">) get_tag_attr_s: get_tag_attr_s ("tip", Paket) artık xml olmalıdır –