From 9e018532c88f72e57b43b15efb2e4a86c8ffda2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Thu, 2 Oct 2008 13:52:39 +0000 Subject: [PATCH] o In #jid, when the node isn't specified, it defaults to the atom "undefined", not an empty binary. o Fix a bug where we expected an #xmlelement to have only one #xmlcdata child. SVN Revision: 1593 --- ChangeLog | 4 ++++ src/mod_echo.erl | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 426d4c588..457d50962 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,10 @@ exmpp_xml:get_element_by_name/2 is deprecated; use exmpp_xml:get_element/2 instead. + * src/mod_echo.erl: In #jid, when the node isn't specified, it + defaults to the atom "undefined", not an empty binary. Fix a bug where + we expected an #xmlelement to have only one #xmlcdata child. + 2008-10-01 Jean-Sébastien Pédron * src/mod_offline_odbc.erl, src/mod_vcard_odbc.erl, diff --git a/src/mod_echo.erl b/src/mod_echo.erl index 9e9748b55..991788a3f 100644 --- a/src/mod_echo.erl +++ b/src/mod_echo.erl @@ -119,7 +119,7 @@ handle_cast(_Msg, State) -> %%-------------------------------------------------------------------- handle_info({route, From, To, Packet}, State) -> Packet2 = case From#jid.node of - <<>> -> exmpp_stanza:reply_with_error(Packet, 'bad-request'); + undefined -> exmpp_stanza:reply_with_error(Packet, 'bad-request'); _ -> Packet end, do_client_version(disabled, To, From), % Put 'enabled' to enable it @@ -195,7 +195,7 @@ do_client_version(enabled, From, To) -> after 5000 -> % Timeout in miliseconds: 5 seconds [] end, - Values = [{Name, binary_to_list(Value)} || #xmlel{name = Name, children = [#xmlcdata{cdata = Value}]} <- Els], + Values = [{Name, exmpp_xml:get_cdata_as_list(Children)} || #xmlel{name = Name, children = Children} <- Els], %% Print in log Values_string1 = [io_lib:format("~n~s: ~p", [N, V]) || {N, V} <- Values],