0
votes

I, i have updated ejabberd from 16.01 to 16.03, i have a problem with my module, before update this line of code

Type = Packet#xmlel.attrs,
    io:format("types:~p~n" , [Type]),
    %Get raw data of message
    Message         = xml:element_to_binary(Packet).

works fine, now after update produce this:

types:[{<<"type">>,<<"chat">>}, {<<"to">>,<<"[email protected]">>},
       {<<"from">>,<<"[email protected]">>}]

16:57:13.393 [error] 
{undef,
  [{xml,element_to_binary,
    [{xmlel,<<"message">>,
      [{<<"type">>,<<"chat">>},
       {<<"to">>,<<"[email protected]">>},
       {<<"from">>,<<"[email protected]">>}],
      [{xmlel,<<"composing">>,
        [{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],
        []}]}], []},
   {ejabberd_hooks,safe_apply,3,
     [{file,"src/ejabberd_hooks.erl"},{line,382}]},
   {ejabberd_hooks,run1,3,
     [{file,"src/ejabberd_hooks.erl"},{line,329}]},
   {ejabberd_sm,route,3,
     [{file,"src/ejabberd_sm.erl"},{line,114}]},
   {ejabberd_local,route,3,
     [{file,"src/ejabberd_local.erl"},{line,112}]},
   {ejabberd_router,route,3,
     [{file,"src/ejabberd_router.erl"},{line,77}]},
   {ejabberd_c2s,check_privacy_route,5,
     [{file,"src/ejabberd_c2s.erl"},{line,2110}]},
   {ejabberd_c2s,session_established2,2,
     [{file,"src/ejabberd_c2s.erl"},{line,1271}]}]}

running hook: 
{offline_message_hook,
  [{jid,<<"121">>,<<"node0.frind.it">>,
    <<"97395769126380428951460048231139020">>,<<"121">>,
    <<"node0.frind.it">>,
    <<"97395769126380428951460048231139020">>},
   {jid,<<"154">>,<<"node0.frind.it">>,<<>>,<<"154">>,
    <<"node0.frind.it">>,<<>>},
   {xmlel,<<"message">>,
     [{<<"type">>,<<"chat">>},
      {<<"to">>,<<"[email protected]">>},
      {<<"from">>,<<"[email protected]">>}],
  [{xmlel,<<"composing">>,
    [{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]}]}
]}

Anyone can help me?

1
Looks like either xml:element_to_binary doesn't exist or it doesn't accept the Packet as its argument.Greg

1 Answers

2
votes

Latest ejabberd move to library fast_xml. Use fxml module instead of xml.