--- a/mod_auto_answer_disco_info/mod_auto_answer_disco_info.lua Fri Aug 24 20:49:54 2018 +0200
+++ b/mod_auto_answer_disco_info/mod_auto_answer_disco_info.lua Fri Aug 24 20:55:10 2018 +0200
@@ -2,15 +2,9 @@
local st = require "util.stanza";
-local function iq_stanza_handler(event)
+local function disco_handler(event)
local stanza, origin = event.stanza, event.origin;
- local type = stanza.attr.type;
-
- local query = stanza:get_child("query", "http://jabber.org/protocol/disco#info");
- if type ~= "get" or query == nil then
- return;
- end
-
+ local query = stanza.tags[1];
local to = stanza.attr.to;
local node = query.attr.node;
@@ -30,4 +24,4 @@
end
end
-module:hook("iq/full", iq_stanza_handler, 1);
+module:hook("iq-get/full/http://jabber.org/protocol/disco#info:query", disco_handler, 1);