Software /
code /
prosody-modules
Comparison
mod_auto_answer_disco_info/mod_auto_answer_disco_info.lua @ 3081:e0ef90e96931
mod_auto_answer_disco_info: Switch to origin.log to provide better debug to admins.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 01 Jun 2018 18:40:30 +0200 |
parent | 2912:6e5bd5d8a5e2 |
child | 3106:1fe7da46e915 |
comparison
equal
deleted
inserted
replaced
3080:b003d72d9ce6 | 3081:e0ef90e96931 |
---|---|
1 module:depends("cache_c2s_caps"); | 1 module:depends("cache_c2s_caps"); |
2 | 2 |
3 local st = require "util.stanza"; | 3 local st = require "util.stanza"; |
4 | 4 |
5 local function iq_stanza_handler(event) | 5 local function iq_stanza_handler(event) |
6 local stanza = event.stanza; | 6 local stanza, origin = event.stanza, event.origin; |
7 local type = stanza.attr.type; | 7 local type = stanza.attr.type; |
8 | 8 |
9 local query = stanza:get_child("query", "http://jabber.org/protocol/disco#info"); | 9 local query = stanza:get_child("query", "http://jabber.org/protocol/disco#info"); |
10 if type ~= "get" or query == nil then | 10 if type ~= "get" or query == nil then |
11 return; | 11 return; |
21 | 21 |
22 local disco_info = target_session.caps_cache; | 22 local disco_info = target_session.caps_cache; |
23 if disco_info ~= nil and (node == nil or node == disco_info.attr.node) then | 23 if disco_info ~= nil and (node == nil or node == disco_info.attr.node) then |
24 local iq = st.reply(stanza); | 24 local iq = st.reply(stanza); |
25 iq:add_child(st.clone(disco_info)); | 25 iq:add_child(st.clone(disco_info)); |
26 module:log("debug", "Answering disco#info on the behalf of %s", to); | 26 origin.log("debug", "Answering disco#info on the behalf of %s", to); |
27 module:send(iq); | 27 module:send(iq); |
28 return true; | 28 return true; |
29 end | 29 end |
30 end | 30 end |
31 | 31 |