comparison mod_auto_answer_disco_info/mod_auto_answer_disco_info.lua @ 2911:43adc18ff9f3

mod_auto_answer_disco_info: Don’t answer if the target session isn’t online
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 07 Mar 2018 20:15:20 +0100
parents 01692f0052e8
children 6e5bd5d8a5e2
comparison
equal deleted inserted replaced
2910:415455faccae 2911:43adc18ff9f3
13 13
14 local to = stanza.attr.to; 14 local to = stanza.attr.to;
15 local node = query.attr.node; 15 local node = query.attr.node;
16 16
17 local target_session = prosody.full_sessions[to]; 17 local target_session = prosody.full_sessions[to];
18 if target_session == nil then
19 return;
20 end
21
18 local disco_info = target_session.caps_cache; 22 local disco_info = target_session.caps_cache;
19 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
20 local iq = st.reply(stanza); 24 local iq = st.reply(stanza);
21 iq:add_child(st.clone(disco_info)); 25 iq:add_child(st.clone(disco_info));
22 module:log("debug", "Answering disco#info on the behalf of the recipient") 26 module:log("debug", "Answering disco#info on the behalf of the recipient")