Software / code / prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
| 6023:93b4058e3320 | 6024:c352d97cf137 |
|---|---|
| 42 local up; | 42 local up; |
| 43 if stanza then stanza:tag(name, attr); up = true; else stanza = st.stanza(name, attr); end | 43 if stanza then stanza:tag(name, attr); up = true; else stanza = st.stanza(name, attr); end |
| 44 for _, a in ipairs(tuple[4]) do build_stanza(a, stanza); end | 44 for _, a in ipairs(tuple[4]) do build_stanza(a, stanza); end |
| 45 if up then stanza:up(); else return stanza end | 45 if up then stanza:up(); else return stanza end |
| 46 elseif tuple[1] == "xmlcdata" then | 46 elseif tuple[1] == "xmlcdata" then |
| 47 assert(type(tuple[2]) == "string", "XML CDATA has unexpected type: "..type(tuple[2])); | 47 if type(tuple[2]) ~= "table" then |
| 48 stanza:text(tuple[2]); | 48 assert(type(tuple[2]) == "string", "XML CDATA has unexpected type: "..type(tuple[2])); |
| 49 stanza:text(tuple[2]); | |
| 50 end -- else it's [], i.e., the null value, used for the empty string | |
| 49 else | 51 else |
| 50 error("unknown element type: "..serialize(tuple)); | 52 error("unknown element type: "..serialize(tuple)); |
| 51 end | 53 end |
| 52 end | 54 end |
| 53 function build_time(tuple) | 55 function build_time(tuple) |