changeset 46:ea756d96584f

mod_privacy: nicer debug logging ...
author Thilo Cestonaro <thilo@cestona.ro>
date Fri, 16 Oct 2009 21:30:59 +0200
parents 3f5bbd7c90d4
children 99ff520519fe
files mod_privacy/mod_privacy.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_privacy/mod_privacy.lua	Fri Oct 16 20:51:14 2009 +0200
+++ b/mod_privacy/mod_privacy.lua	Fri Oct 16 21:30:59 2009 +0200
@@ -323,7 +323,7 @@
 	local privacy_lists = datamanager.load(session.username, session.host, "privacy") or {};
 	local bare_jid = session.username.."@"..session.host;
 
-	module:log("debug", "stanza: %s, to: %s, from: %s", stanza.name, stanza.attr.to or "nil", stanza.attr.from or "nil");
+	module:log("debug", "stanza: %s, to: %s, from: %s", tostring(stanza.name), tostring(stanza.attr.to), tostring(stanza.attr.from));
 	
 	if stanza.attr.to ~= nil and stanza.attr.from ~= nil then
 		if privacy_lists.lists == nil or
@@ -406,7 +406,7 @@
 			end
 			if apply then
 				if block then
-					module:log("info", "stanza blocked: %s, to: %s, from: %s", stanza.name, stanza.attr.to or "nil", stanza.attr.from or "nil");
+					module:log("info", "stanza blocked: %s, to: %s, from: %s", tostring(stanza.name), tostring(stanza.attr.to), tostring(stanza.attr.from));
 					if stanza.name == "message" then
 						origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
 					elseif stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then
@@ -447,7 +447,7 @@
 		if session ~= nil then
 			return checkIfNeedToBeBlocked(e, session);
 		else
-			module:log("debug", "preCheckIncoming: Couldn't get session for jid: %s@%s/%s", node or "nil", host or "nil", resource or "nil")
+			module:log("debug", "preCheckIncoming: Couldn't get session for jid: %s@%s/%s", tostring(node), tostring(host), tostring(resource))
 		end
 	end
 	return;