# HG changeset patch # User Emmanuel Gil Peyrot # Date 1492206359 -3600 # Node ID 352d605b1178aa66a95033ca026afe6589430a93 # Parent 39f24de4f53f2365a22f629d307f7bd5e7111b9a mod_pubsub: Fix a few warnings [luacheck] diff -r 39f24de4f53f -r 352d605b1178 plugins/mod_pubsub/mod_pubsub.lua --- a/plugins/mod_pubsub/mod_pubsub.lua Tue Sep 12 16:16:28 2017 +0100 +++ b/plugins/mod_pubsub/mod_pubsub.lua Fri Apr 14 22:45:59 2017 +0100 @@ -16,7 +16,6 @@ local lib_pubsub = module:require "pubsub"; local handlers = lib_pubsub.handlers; -local pubsub_error_reply = lib_pubsub.pubsub_error_reply; module:depends("disco"); module:add_identity("pubsub", "service", pubsub_disco_name); @@ -24,8 +23,8 @@ function handle_pubsub_iq(event) local origin, stanza = event.origin, event.stanza; - local pubsub = stanza.tags[1]; - local action = pubsub.tags[1]; + local pubsub_tag = stanza.tags[1]; + local action = pubsub_tag.tags[1]; if not action then origin.send(st.error_reply(stanza, "cancel", "bad-request")); return true; @@ -90,7 +89,7 @@ end module:hook("host-disco-info-node", function (event) - local stanza, origin, reply, node = event.stanza, event.origin, event.reply, event.node; + local stanza, reply, node = event.stanza, event.reply, event.node; local ok, ret = service:get_nodes(stanza.attr.from); if not ok or not ret[node] then return; @@ -100,7 +99,7 @@ end); module:hook("host-disco-items-node", function (event) - local stanza, origin, reply, node = event.stanza, event.origin, event.reply, event.node; + local stanza, reply, node = event.stanza, event.reply, event.node; local ok, ret = service:get_items(node, stanza.attr.from); if not ok then return; @@ -114,8 +113,8 @@ module:hook("host-disco-items", function (event) - local stanza, origin, reply = event.stanza, event.origin, event.reply; - local ok, ret = service:get_nodes(event.stanza.attr.from); + local stanza, reply = event.stanza, event.reply; + local ok, ret = service:get_nodes(stanza.attr.from); if not ok then return; end diff -r 39f24de4f53f -r 352d605b1178 plugins/mod_pubsub/pubsub.lib.lua --- a/plugins/mod_pubsub/pubsub.lib.lua Tue Sep 12 16:16:28 2017 +0100 +++ b/plugins/mod_pubsub/pubsub.lib.lua Fri Apr 14 22:45:59 2017 +0100 @@ -1,3 +1,5 @@ +local t_unpack = table.unpack or unpack; -- luacheck: ignore 113 + local st = require "util.stanza"; local uuid_generate = require "util.uuid".generate; local dataform = require"util.dataforms".new; @@ -23,7 +25,7 @@ }; local function pubsub_error_reply(stanza, error) local e = pubsub_errors[error]; - local reply = st.error_reply(stanza, unpack(e, 1, 3)); + local reply = st.error_reply(stanza, t_unpack(e, 1, 3)); if e[4] then reply:tag(e[4], { xmlns = xmlns_pubsub_errors }):up(); end @@ -47,13 +49,13 @@ function handlers.get_items(origin, stanza, items, service) local node = items.attr.node; local item = items:get_child("item"); - local id = item and item.attr.id; + local item_id = item and item.attr.id; if not node then origin.send(pubsub_error_reply(stanza, "nodeid-required")); return true; end - local ok, results = service:get_items(node, stanza.attr.from, id); + local ok, results = service:get_items(node, stanza.attr.from, item_id); if not ok then origin.send(pubsub_error_reply(stanza, results)); return true; @@ -122,7 +124,7 @@ function handlers.set_delete(origin, stanza, delete, service) local node = delete.attr.node; - local reply, notifier; + local reply; if not node then origin.send(pubsub_error_reply(stanza, "nodeid-required")); return true;