aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-08-24 20:34:18 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-08-24 20:34:18 +0200
commit00d9da2914d810dd64cf2161273d2899d3537fc7 (patch)
tree3dea628b6013bddae2fefd90edc381e179b74ca2
parenta70ba0645cc77984827877e2dba62baf84aa1d68 (diff)
downloadprosody-00d9da2914d810dd64cf2161273d2899d3537fc7.tar.gz
prosody-00d9da2914d810dd64cf2161273d2899d3537fc7.zip
mod_disco: Simplify iq handling by hooking on iq-get/ instead of iq/.
-rw-r--r--plugins/mod_disco.lua12
1 files changed, 4 insertions, 8 deletions
diff --git a/plugins/mod_disco.lua b/plugins/mod_disco.lua
index 6d3e7753..a5479f4c 100644
--- a/plugins/mod_disco.lua
+++ b/plugins/mod_disco.lua
@@ -95,9 +95,8 @@ module:hook("item-removed/feature", clear_disco_cache);
module:hook("item-removed/extension", clear_disco_cache);
-- Handle disco requests to the server
-module:hook("iq/host/http://jabber.org/protocol/disco#info:query", function(event)
+module:hook("iq-get/host/http://jabber.org/protocol/disco#info:query", function(event)
local origin, stanza = event.origin, event.stanza;
- if stanza.attr.type ~= "get" then return; end
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});
@@ -117,9 +116,8 @@ module:hook("iq/host/http://jabber.org/protocol/disco#info:query", function(even
origin.send(reply);
return true;
end);
-module:hook("iq/host/http://jabber.org/protocol/disco#items:query", function(event)
+module:hook("iq-get/host/http://jabber.org/protocol/disco#items:query", function(event)
local origin, stanza = event.origin, event.stanza;
- if stanza.attr.type ~= "get" then return; end
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});
@@ -155,9 +153,8 @@ end);
-- Handle disco requests to user accounts
if module:get_host_type() ~= "local" then return end -- skip for components
-module:hook("iq/bare/http://jabber.org/protocol/disco#info:query", function(event)
+module:hook("iq-get/bare/http://jabber.org/protocol/disco#info:query", function(event)
local origin, stanza = event.origin, event.stanza;
- if stanza.attr.type ~= "get" then return; end
local node = stanza.tags[1].attr.node;
local username = jid_split(stanza.attr.to) or origin.username;
if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then
@@ -182,9 +179,8 @@ module:hook("iq/bare/http://jabber.org/protocol/disco#info:query", function(even
return true;
end
end);
-module:hook("iq/bare/http://jabber.org/protocol/disco#items:query", function(event)
+module:hook("iq-get/bare/http://jabber.org/protocol/disco#items:query", function(event)
local origin, stanza = event.origin, event.stanza;
- if stanza.attr.type ~= "get" then return; end
local node = stanza.tags[1].attr.node;
local username = jid_split(stanza.attr.to) or origin.username;
if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then