# HG changeset patch # User Kim Alvefur # Date 1491078637 -7200 # Node ID 3b2cc22e9b5bf4a2d4f6874c4b88205fc8108aa1 # Parent 62c540d51d50d6374dec5e792a22fe9724451cdf mod_disco: Rename variables to avoid name clash [luacheck] diff -r 62c540d51d50 -r 3b2cc22e9b5b plugins/mod_disco.lua --- a/plugins/mod_disco.lua Sat Apr 01 22:18:44 2017 +0200 +++ b/plugins/mod_disco.lua Sat Apr 01 22:30:37 2017 +0200 @@ -101,10 +101,10 @@ local node = stanza.tags[1].attr.node; if node and node ~= "" and node ~= "http://prosody.im#"..get_server_caps_hash() then local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info', node=node}); - local event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; - local ret = module:fire_event("host-disco-info-node", event); + local node_event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; + local ret = module:fire_event("host-disco-info-node", node_event); if ret ~= nil then return ret; end - if event.exists then + if node_event.exists then origin.send(reply); else origin.send(st.error_reply(stanza, "cancel", "item-not-found", "Node does not exist")); @@ -123,10 +123,10 @@ local node = stanza.tags[1].attr.node; if node and node ~= "" then local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#items', node=node}); - local event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; - local ret = module:fire_event("host-disco-items-node", event); + local node_event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; + local ret = module:fire_event("host-disco-items-node", node_event); if ret ~= nil then return ret; end - if event.exists then + if node_event.exists then origin.send(reply); else origin.send(st.error_reply(stanza, "cancel", "item-not-found", "Node does not exist")); @@ -163,10 +163,10 @@ if node and node ~= "" then local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info', node=node}); if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account - local event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; - local ret = module:fire_event("account-disco-info-node", event); + local node_event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; + local ret = module:fire_event("account-disco-info-node", node_event); if ret ~= nil then return ret; end - if event.exists then + if node_event.exists then origin.send(reply); else origin.send(st.error_reply(stanza, "cancel", "item-not-found", "Node does not exist")); @@ -189,10 +189,10 @@ if node and node ~= "" then local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#items', node=node}); if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account - local event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; - local ret = module:fire_event("account-disco-items-node", event); + local node_event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; + local ret = module:fire_event("account-disco-items-node", node_event); if ret ~= nil then return ret; end - if event.exists then + if node_event.exists then origin.send(reply); else origin.send(st.error_reply(stanza, "cancel", "item-not-found", "Node does not exist"));