comparison mod_query_client_ver/mod_query_client_ver.lua @ 2652:20ebfa4ad7f4

mod_query_client_ver: Signal that events are handled even when no response is returned (see #876)
author Kim Alvefur <zash@zash.se>
date Thu, 30 Mar 2017 21:04:40 +0200
parents b5f9f1111a8b
children 96eabf8591a6
comparison
equal deleted inserted replaced
2651:2b741e68433b 2652:20ebfa4ad7f4
32 origin.log("info", "Running %s", client); 32 origin.log("info", "Running %s", client);
33 return true; 33 return true;
34 end 34 end
35 end 35 end
36 origin.send(st.iq({ id = disco_id, type = "get", from = module.host, to = origin.full_jid }):query(xmlns_disco_info)); 36 origin.send(st.iq({ id = disco_id, type = "get", from = module.host, to = origin.full_jid }):query(xmlns_disco_info));
37 return true;
37 end); 38 end);
38 39
39 module:hook("iq-result/host/"..disco_id, function(event) 40 module:hook("iq-result/host/"..disco_id, function(event)
40 local origin, stanza = event.origin, event.stanza; 41 local origin, stanza = event.origin, event.stanza;
41 local query = stanza:get_child("query", xmlns_disco_info); 42 local query = stanza:get_child("query", xmlns_disco_info);
42 if query then 43 if query then
43 local ident = query:get_child("identity"); 44 local ident = query:get_child("identity");
44 if ident and ident.attr.name then 45 if ident and ident.attr.name then
45 origin.log("info", "Running %s", ident.attr.name); 46 origin.log("info", "Running %s", ident.attr.name);
46 return true;
47 end 47 end
48 end 48 end
49 -- Unknown software 49 -- Unknown software
50 return true;
50 end); 51 end);
51 52