我有一个带有数据包数据的打印日志,我使用Packet#message.sub_els
提取了子元素,它给了我这样的数组:
[
{xmlel,<<"delay">>,[{<<"xmlns">>,<<"urn:xmpp:delay">>},{<<"stamp">>,<<"2019-10-24T08:08:15.126+00:00">>}],[]},
{xmlel,<<"type">>,[{<<"xmlns">>,<<"urn:xmpp:media">>}],[{xmlcdata,<<"1">>}]},
{xmlel,<<"media">>,[{<<"xmlns">>,<<"urn:xmpp:data">>}],[{xmlcdata,<<"null">>}]},
{xmlel,<<"extra">>,[{<<"xmlns">>,<<"urn:xmpp:extra">>}],[{xmlcdata,<<"{\"type\":\"chat\",\"id\":\"5d666434ae920b04875c0a57\",\"name\":\"X003\",\"username\":\"x003\",\"status\":\"\",\"profile_picture\":\"\"}">>}]},
{xmlel,<<"request">>,[{<<"xmlns">>,<<"urn:xmpp:receipts">>}],[]},
{xmlel,<<"request">>,[{<<"xmlns">>,<<"urn:xmpp:read">>}],[]}
],
现在,我想添加其他类型,媒体,其他。等
请参阅指导xmpp库的开发人员文档:https://docs.ejabberd.im/developer/guide/#xmpp-module