From bba90ea30affabccdc2d3a011ef1ef8276fca759 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 17 Oct 2016 23:23:36 +0200 Subject: mod_carbons: Fix logic presendence --- plugins/mod_carbons.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_carbons.lua b/plugins/mod_carbons.lua index 951645f8..4d8175ef 100644 --- a/plugins/mod_carbons.lua +++ b/plugins/mod_carbons.lua @@ -26,7 +26,7 @@ local function message_handler(event, c2s) local orig_from = stanza.attr.from; local orig_to = stanza.attr.to; - if not(orig_type == "chat" or orig_type == "normal" and stanza:get_child("body")) then + if not(orig_type == "chat" or (orig_type == "normal" and stanza:get_child("body"))) then return -- Only chat type messages end -- cgit v1.2.3 From 53bcabeef5c2e2002f6d94caff2a6dbd1b2dc329 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 18 Oct 2016 15:16:18 +0200 Subject: util.array: Rename arguments to avoid name clash [luacheck] --- util/array.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/array.lua b/util/array.lua index 3ddc97f6..4b5b36c7 100644 --- a/util/array.lua +++ b/util/array.lua @@ -19,7 +19,7 @@ local type = type; local array = {}; local array_base = {}; local array_methods = {}; -local array_mt = { __index = array_methods, __tostring = function (array) return "{"..array:concat(", ").."}"; end }; +local array_mt = { __index = array_methods, __tostring = function (self) return "{"..self:concat(", ").."}"; end }; local function new_array(self, t, _s, _var) if type(t) == "function" then -- Assume iterator @@ -115,10 +115,10 @@ function array_methods:shuffle(outa, ina) return self; end -function array_methods:append(array) - local len, len2 = #self, #array; +function array_methods:append(ina) + local len, len2 = #self, #ina; for i = 1, len2 do - self[len+i] = array[i]; + self[len+i] = ina[i]; end return self; end -- cgit v1.2.3 From 71d4c99a5de0b78a9d72bd85c7a0293bfd9dbd16 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 18 Oct 2016 15:16:30 +0200 Subject: util.array: Remove unused arguments [luacheck] --- util/array.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/array.lua b/util/array.lua index 4b5b36c7..ea520f6b 100644 --- a/util/array.lua +++ b/util/array.lua @@ -106,7 +106,7 @@ function array_base.reverse(outa, ina) end --- These methods only mutate the array -function array_methods:shuffle(outa, ina) +function array_methods:shuffle() local len = #self; for i = 1, #self do local r = math_random(i, len); -- cgit v1.2.3 From 2fa313a15ffb9d266bbaf93efd1436f237333b07 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 18 Oct 2016 15:17:29 +0200 Subject: util.statsd: Ignore unused argument [luacheck] --- util/statsd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/statsd.lua b/util/statsd.lua index 2874e8a8..e5322de9 100644 --- a/util/statsd.lua +++ b/util/statsd.lua @@ -44,7 +44,7 @@ local function new(config) end return function (new_v) send_gauge(name, new_v); end end; - counter = function (name, initial) + counter = function (name, initial) --luacheck: ignore 212/initial return function (delta) send_gauge(name, delta, true); end; -- cgit v1.2.3 From 5205d9f5b392eb41f80bcc3e44c0317532cc6bac Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 18 Oct 2016 15:19:01 +0200 Subject: util.cache: Ignore unused argument [luacheck] --- util/cache.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/util/cache.lua b/util/cache.lua index 44bbfe30..9c141bb6 100644 --- a/util/cache.lua +++ b/util/cache.lua @@ -117,6 +117,7 @@ function cache_methods:tail() end function cache_methods:table() + --luacheck: ignore 212/t if not self.proxy_table then self.proxy_table = setmetatable({}, { __index = function (t, k) -- cgit v1.2.3 From 5bbd2aa2ff4137e9dc7b47ee76723319cbfc75dc Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 18 Oct 2016 15:29:23 +0200 Subject: util.pubsub: Rename loop variable to avoid name clash [luacheck] --- util/pubsub.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/pubsub.lua b/util/pubsub.lua index 520d80a7..e96df5fc 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -371,13 +371,13 @@ function service:get_subscriptions(node, actor, jid) -- a get_subscription() call for each node. local ret = {}; if subs then - for jid, subscribed_nodes in pairs(subs) do + for subscribed_jid, subscribed_nodes in pairs(subs) do if node then -- Return only subscriptions to this node if subscribed_nodes[node] then ret[#ret+1] = { node = node; - jid = jid; - subscription = node_obj.subscribers[jid]; + jid = subscribed_jid; + subscription = node_obj.subscribers[subscribed_jid]; }; end else -- Return subscriptions to all nodes @@ -385,8 +385,8 @@ function service:get_subscriptions(node, actor, jid) for subscribed_node in pairs(subscribed_nodes) do ret[#ret+1] = { node = subscribed_node; - jid = jid; - subscription = nodes[subscribed_node].subscribers[jid]; + jid = subscribed_jid; + subscription = nodes[subscribed_node].subscribers[subscribed_jid]; }; end end -- cgit v1.2.3