Not sure if it is my Erlang, or exmpp crashing here:
22> jn_component:start(“jn.localhost”,“secret”,“localhost”, 8888, “127.0.0.1”).
<0.333.0>
{received_packet,iq,“get”,
{<<“user2”>>,<<“localhost”>>,<<“Thiago-Camargos-MacBook-Pro”>>},
“aacaa”,undefined,
{xmlel,‘jabber:component:accept’,[],iq,
[{xmlattr,undefined,from,
<<“user2@localhost/Thiago-Camargos-MacBook-Pro”>>},
{xmlattr,undefined,to,<<“jn.localhost”>>},
{xmlattr,‘http://www.w3.org/XML/1998/namespace’,“lang”,<<“en”>>},
{xmlattr,undefined,type,<<“get”>>},
{xmlattr,undefined,id,<<“aacaa”>>}],
[{xmlcdata,<<”\n”>>},
{xmlel,‘http://jabber.org/protocol/disco#info’,
[{‘http://jabber.org/protocol/disco#info’,none}],
‘query’,[],[]},
{xmlcdata,<<”\n”>>}]}}
23>
=ERROR REPORT==== 19-Nov-2009::17:29:56 ===
Error in process <0.333.0> with exit value: {function_clause,[{jn_component,process_iq,[<0.334.0>,{xmlel,‘jabber:component:accept’,[],iq,[{xmlattr,undefined,from,<<43 bytes>>},{xmlattr,undefined,to,<<12 bytes>>},{xmlattr,‘http://www.w3.org/XML/1998/namespace’,“lang”,<<2 bytes>>},{xmlattr,undefined…
—————————————————————————————————
The code portion is:
loop(XmppCom, JID, PubIP) ->
receive
stop ->
exmpp_component:stop(XmppCom);
%% If we receive a message, we reply with the same message
Record = #received_packet{packet_type=message, raw_packet=Packet} ->
io:format("~p~n", [Record]),
process_message(XmppCom, Packet, JID),
loop(XmppCom, JID, PubIP);
Record = #received_packet{packet_type=iq, type_attr=Type, raw_packet=IQ} ->
io:format("~p~n", [Record]),
process_iq(XmppCom, IQ, Type, PubIP,exmpp_xml:get_ns_as_atom(exmpp_iq:get_payload(IQ))),
loop(XmppCom, JID, PubIP);
Record ->
io:format("~p~n", [Record]),
loop(XmppCom, JID, PubIP)
end.
%% Create Channel and return details
process_iq(XmppCom, "get", IQ, PubIP, ?NS_CHANNEL) ->
case allocate_relay() of
{A, B} ->
Result = exmpp_iq:result(IQ,get_candidate_elem(PubIP, A, B)),
exmpp_component:send_packet(XmppCom, Result);
_ ->
Error = exmpp_iq:error(IQ),
exmpp_component:send_packet(XmppCom, Error)
end;
process_iq(XmppCom, "get", IQ, _, ?NS_DISCO_INFO) ->
Identity = exmpp_xml:element(?NS_DISCO_INFO, 'identity', [exmpp_xml:attribute("category", <<"proxy">>),
exmpp_xml:attribute("type", <<"relay">>),
exmpp_xml:attribute("name", <<"Jingle Nodes Relay">>)
],
[]),
IQRegisterFeature1 = exmpp_xml:element(?NS_DISCO_INFO, 'feature', [exmpp_xml:attribute('var', ?NS_JINGLE_NODES_s)],[]),
IQRegisterFeature2 = exmpp_xml:element(?NS_DISCO_INFO, 'feature', [exmpp_xml:attribute('var', ?NS_CHANNEL_s)],[]),
Result = exmpp_iq:result(IQ, exmpp_xml:element(?NS_DISCO_INFO, 'query', [], [Identity, IQRegisterFeature1, IQRegisterFeature2])),
exmpp_component:send_packet(XmppCom, Result);
process_iq(XmppCom, "set", IQ, _, _) ->
Error = exmpp_iq:error(IQ,'feature-not-implemented'),
exmpp_component:send_packet(XmppCom, Error).
