mod_ircd: Log error when receiving a message without a valid nick
authorMatthew Wild <mwild1@gmail.com>
Wed, 19 May 2010 14:11:34 +0100
changeset 154 1849614af19a
parent 153 31e24026e4fd
child 155 7a037cb5ab9e
mod_ircd: Log error when receiving a message without a valid nick
mod_ircd/mod_ircd.lua
--- a/mod_ircd/mod_ircd.lua	Wed May 19 14:02:19 2010 +0100
+++ b/mod_ircd/mod_ircd.lua	Wed May 19 14:11:34 2010 +0100
@@ -154,13 +154,16 @@
 			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 ~= "" and nick then
 				for session in pairs(joined_muc.sessions) do
 					if nick ~= session.nick or hasdelay then
 						session.send(":"..nick.." PRIVMSG "..from_node.." :"..body);
 					end
 				end
 			end
+			if not nick then
+				module:log("error", "Invalid nick from JID: %s", from);
+			end
 		end
 	end
 end