comparison mod_query_client_ver/mod_query_client_ver.lua @ 2653:96eabf8591a6

mod_query_client_ver: Handle IQ errors (see #876)
author Kim Alvefur <zash@zash.se>
date Thu, 30 Mar 2017 21:12:14 +0200
parents 20ebfa4ad7f4
children cb8d65b40fb4
comparison
equal deleted inserted replaced
2652:20ebfa4ad7f4 2653:96eabf8591a6
28 local version = query:get_child_text("version"); 28 local version = query:get_child_text("version");
29 if version then 29 if version then
30 client = client .. " version " .. version; 30 client = client .. " version " .. version;
31 end 31 end
32 origin.log("info", "Running %s", client); 32 origin.log("info", "Running %s", client);
33 return true;
34 end 33 end
35 end 34 end
35 return true;
36 end);
37
38 module:hook("iq-error/host/"..version_id, function(event)
39 local origin, stanza = event.origin, event.stanza;
36 origin.send(st.iq({ id = disco_id, type = "get", from = module.host, to = origin.full_jid }):query(xmlns_disco_info)); 40 origin.send(st.iq({ id = disco_id, type = "get", from = module.host, to = origin.full_jid }):query(xmlns_disco_info));
37 return true; 41 return true;
38 end); 42 end);
39 43
40 module:hook("iq-result/host/"..disco_id, function(event) 44 module:hook("iq-result/host/"..disco_id, function(event)
44 local ident = query:get_child("identity"); 48 local ident = query:get_child("identity");
45 if ident and ident.attr.name then 49 if ident and ident.attr.name then
46 origin.log("info", "Running %s", ident.attr.name); 50 origin.log("info", "Running %s", ident.attr.name);
47 end 51 end
48 end 52 end
49 -- Unknown software
50 return true; 53 return true;
51 end); 54 end);
52 55
56 module:hook("iq-error/host/"..disco_id, function()
57 return true; -- Doesn't reply to disco#info? Weird, but ignore for now.
58 end);