diff mod_ircd/mod_ircd.lua @ 150:fd7f7ebf257e

mod_ircd: Fixed handling of empty <body/> elements.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 13 May 2010 14:45:10 +0500
parents d4ff1cd414e5
children 5abf15351b9a
line wrap: on
line diff
--- a/mod_ircd/mod_ircd.lua	Thu Apr 15 23:57:07 2010 +0200
+++ b/mod_ircd/mod_ircd.lua	Thu May 13 14:45:10 2010 +0500
@@ -152,11 +152,12 @@
 			end
 		elseif stanza.name == "message" then
 			local body = stanza:get_child("body");
+			body = body and body:get_text() or "";
 			local hasdelay = stanza:get_child("delay", "urn:xmpp:delay");
-			if body then
+			if body ~= "" then
 				for session in pairs(joined_muc.sessions) do
 					if nick ~= session.nick or hasdelay then
-						session.send(":"..nick.." PRIVMSG "..from_node.." :"..body:get_text());
+						session.send(":"..nick.." PRIVMSG "..from_node.." :"..body);
 					end
 				end
 			end