Comparison

plugins/mod_version.lua @ 9227:c0e058633d9a

mod_version: Simplify iq handling by hooking on iq-get/ instead of iq/.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 24 Aug 2018 20:35:33 +0200
parent 7977:01d6298de991
child 9229:1338b84c0566
comparison
equal deleted inserted replaced
9226:affd84be3fc3 9227:c0e058633d9a
37 version = version:match("^%s*(.-)%s*$") or version; 37 version = version:match("^%s*(.-)%s*$") or version;
38 query:tag("os"):text(version):up(); 38 query:tag("os"):text(version):up();
39 end 39 end
40 end 40 end
41 41
42 module:hook("iq/host/jabber:iq:version:query", function(event) 42 module:hook("iq-get/host/jabber:iq:version:query", function(event)
43 local stanza = event.stanza; 43 local stanza = event.stanza;
44 if stanza.attr.type == "get" and stanza.attr.to == module.host then 44 if stanza.attr.to == module.host then
45 event.origin.send(st.reply(stanza):add_child(query)); 45 event.origin.send(st.reply(stanza):add_child(query));
46 return true; 46 return true;
47 end 47 end
48 end); 48 end);