# HG changeset patch # User Kim Alvefur # Date 1507498975 -7200 # Node ID 053cf683c2c7555d83300c05171cf305299a9b9b # Parent 4852def7dc495f531462174c94a409c6ec3553d1 mod_pep_plus: Rename variable for clarity diff -r 4852def7dc49 -r 053cf683c2c7 plugins/mod_pep_plus.lua --- 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