Diff

plugins/mod_pep_plus.lua @ 8303:053cf683c2c7

mod_pep_plus: Rename variable for clarity
author Kim Alvefur <zash@zash.se>
date Sun, 08 Oct 2017 23:42:55 +0200
parent 8300:7759eb130938
child 8304:9f8476c77fa8
line wrap: on
line diff
--- a/plugins/mod_pep_plus.lua	Sun Oct 08 21:20:21 2017 +0200
+++ b/plugins/mod_pep_plus.lua	Sun Oct 08 23:42:55 2017 +0200
@@ -279,10 +279,10 @@
 	local origin, stanza = event.origin, event.stanza;
 	local user = stanza.attr.to or (origin.username..'@'..origin.host);
 	local t = stanza.attr.type;
-	local self = not stanza.attr.to;
+	local is_self = not stanza.attr.to;
 
 	if not t then -- available presence
-		if self or subscription_presence(user, stanza.attr.from) then
+		if is_self or subscription_presence(user, stanza.attr.from) then
 			local recipient = stanza.attr.from;
 			local current = recipients[user] and recipients[user][recipient];
 			local hash, query_node = get_caps_hash_from_presence(stanza, current);
@@ -296,7 +296,7 @@
 				else
 					recipients[user][recipient] = hash;
 					local from_bare = origin.type == "c2s" and origin.username.."@"..origin.host;
-					if self or origin.type ~= "c2s" or (recipients[from_bare] and recipients[from_bare][origin.full_jid]) ~= hash then
+					if is_self or origin.type ~= "c2s" or (recipients[from_bare] and recipients[from_bare][origin.full_jid]) ~= hash then
 						-- COMPAT from ~= stanza.attr.to because OneTeam can't deal with missing from attribute
 						origin.send(
 							st.stanza("iq", {from=user, to=stanza.attr.from, id="disco", type="get"})
@@ -308,7 +308,7 @@
 		end
 	elseif t == "unavailable" then
 		update_subscriptions(stanza.attr.from, user);
-	elseif not self and t == "unsubscribe" then
+	elseif not is_self and t == "unsubscribe" then
 		local from = jid_bare(stanza.attr.from);
 		local subscriptions = recipients[user];
 		if subscriptions then
@@ -329,7 +329,7 @@
 	end
 
 	-- Process disco response
-	local self = not stanza.attr.to;
+	local is_self = not stanza.attr.to;
 	local user = stanza.attr.to or (origin.username..'@'..origin.host);
 	local contact = stanza.attr.from;
 	local current = recipients[user] and recipients[user][contact];
@@ -346,7 +346,7 @@
 		end
 	end
 	hash_map[ver] = notify; -- update hash map
-	if self then
+	if is_self then
 		for jid, item in pairs(origin.roster) do -- for all interested contacts
 			if item.subscription == "both" or item.subscription == "from" then
 				if not recipients[jid] then recipients[jid] = {}; end