# HG changeset patch # User Emmanuel Gil Peyrot # Date 1535136910 -7200 # Node ID 4cdd1ddae72c7880c31dd3c42fff04fc08fa90c9 # Parent 4b43b317e8f525f3a927100fe7cdf7e74d259ad8 mod_auto_answer_disco_info: Simplify iq handling by hooking on the full payload tag instead of iq/full. diff -r 4b43b317e8f5 -r 4cdd1ddae72c mod_auto_answer_disco_info/mod_auto_answer_disco_info.lua --- 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);