mod_privacy: Rename from_user/to_user flags to is_from_user/is_to_user for clarity

Tue, 09 Feb 2010 06:49:03 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 09 Feb 2010 06:49:03 +0000
changeset 2579
4e0caff152d6
parent 2578
61e5eff54415
child 2580
61f0acd9086f

mod_privacy: Rename from_user/to_user flags to is_from_user/is_to_user for clarity

plugins/mod_privacy.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_privacy.lua	Wed Feb 10 01:58:49 2010 +0500
+++ b/plugins/mod_privacy.lua	Tue Feb 09 06:49:03 2010 +0000
@@ -379,8 +379,8 @@
 	local to = stanza.attr.to;
 	local from = stanza.attr.from;
 	
-	local to_user = bare_jid == jid_bare(to);
-	local from_user = bare_jid == jid_bare(from);
+	local is_to_user = bare_jid == jid_bare(to);
+	local is_from_user = bare_jid == jid_bare(from);
 	
 	module:log("debug", "stanza: %s, to: %s, from: %s", tostring(stanza.name), tostring(to), tostring(from));
 	
@@ -390,7 +390,7 @@
 	then
 		return; -- Nothing to block, default is Allow all
 	end
-	if from_user and to_user then
+	if is_from_user and is_to_user then
 		module:log("debug", "Not blocking communications between user's resources");
 		return; -- from one of a user's resource to another => HANDS OFF!
 	end
@@ -418,8 +418,8 @@
 		if (
 			(stanza.name == "message" and item.message) or
 			(stanza.name == "iq" and item.iq) or
-			(stanza.name == "presence" and to_user and item["presence-in"]) or
-			(stanza.name == "presence" and from_user and item["presence-out"]) or
+			(stanza.name == "presence" and is_to_user and item["presence-in"]) or
+			(stanza.name == "presence" and is_from_user and item["presence-out"]) or
 			(item.message == false and item.iq == false and item["presence-in"] == false and item["presence-out"] == false)
 		) then
 			apply = true;
@@ -427,7 +427,7 @@
 		if apply then
 			local evilJid = {};
 			apply = false;
-			if to_user then
+			if is_to_user then
 				module:log("debug", "evil jid is (from): %s", from);
 				evilJid.node, evilJid.host, evilJid.resource = jid_split(from);
 			else

mercurial