Software /
code /
prosody
Diff
tools/ejabberd2prosody.lua @ 6024:c352d97cf137
tools/ejabberd2prosody: Don't throw an error if XML CDATA is null ([] in Erlang, instead of a string or being missing).
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 18 Feb 2014 16:03:13 -0500 |
parent | 6006:95ce7bfbfa6f |
child | 6027:8c69cea8a1bf |
child | 6280:ce1a20bd2053 |
line wrap: on
line diff
--- a/tools/ejabberd2prosody.lua Mon Feb 17 16:00:41 2014 -0500 +++ b/tools/ejabberd2prosody.lua Tue Feb 18 16:03:13 2014 -0500 @@ -44,8 +44,10 @@ for _, a in ipairs(tuple[4]) do build_stanza(a, stanza); end if up then stanza:up(); else return stanza end elseif tuple[1] == "xmlcdata" then - assert(type(tuple[2]) == "string", "XML CDATA has unexpected type: "..type(tuple[2])); - stanza:text(tuple[2]); + if type(tuple[2]) ~= "table" then + assert(type(tuple[2]) == "string", "XML CDATA has unexpected type: "..type(tuple[2])); + stanza:text(tuple[2]); + end -- else it's [], i.e., the null value, used for the empty string else error("unknown element type: "..serialize(tuple)); end