Changeset

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
parents 6023:93b4058e3320
children 6025:583e5c1365fe
files tools/ejabberd2prosody.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
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