Diff

plugins/mod_blocklist.lua @ 6968:828a10e0464b

mod_blocklist: Rename variable for clarity
author Kim Alvefur <zash@zash.se>
date Sun, 06 Dec 2015 02:07:15 +0100
parent 6967:d90a4d6a0e2c
child 6969:31d8e1a8a014
line wrap: on
line diff
--- a/plugins/mod_blocklist.lua	Sat Dec 05 22:46:50 2015 +0100
+++ b/plugins/mod_blocklist.lua	Sun Dec 06 02:07:15 2015 +0100
@@ -123,9 +123,9 @@
 		new[jid] = is_contact_subscribed(username, module.host, jid) or false;
 	end
 
-	local mode = action.name == "block" or nil;
+	local is_blocking = action.name == "block" or nil; -- nil if unblocking
 
-	if mode and not next(new) then
+	if is_blocking and not next(new) then
 		-- <block/> element does not contain at least one <item/> child element
 		origin.send(st_error_reply(stanza, "modify", "bad-request"));
 		return true;
@@ -135,12 +135,12 @@
 
 	local new_blocklist = {};
 
-	if mode or next(new) then
+	if is_blocking or next(new) then
 		for jid in pairs(blocklist) do
 			new_blocklist[jid] = true;
 		end
 		for jid in pairs(new) do
-			new_blocklist[jid] = mode;
+			new_blocklist[jid] = is_blocking;
 		end
 		-- else empty the blocklist
 	end
@@ -154,7 +154,7 @@
 		return true;
 	end
 
-	if mode then
+	if is_blocking then
 		for jid, in_roster in pairs(new) do
 			if not blocklist[jid] and in_roster and sessions[username] then
 				for _, session in pairs(sessions[username].sessions) do