plugins/version.lua

changeset 51
d044a726fef0
parent 33
4581b2e61429
child 104
58305b983b1a
equal deleted inserted replaced
50:432ac110544f 51:d044a726fef0
28 callback = callback or function (version) return stream:event("version/response", version); end 28 callback = callback or function (version) return stream:event("version/response", version); end
29 stream:send_iq(verse.iq({ type = "get", to = target_jid }) 29 stream:send_iq(verse.iq({ type = "get", to = target_jid })
30 :tag("query", { xmlns = xmlns_version }), 30 :tag("query", { xmlns = xmlns_version }),
31 function (reply) 31 function (reply)
32 local query = reply:get_child("query", xmlns_version); 32 local query = reply:get_child("query", xmlns_version);
33 if query then 33 if reply.attr.type == "result" then
34 local name = query:get_child("name"); 34 local name = query:get_child("name");
35 local version = query:get_child("version"); 35 local version = query:get_child("version");
36 local os = query:get_child("os"); 36 local os = query:get_child("os");
37 callback({ 37 callback({
38 name = name and name:get_text() or nil; 38 name = name and name:get_text() or nil;

mercurial