2 -- Copyright (C) 2008-2010 Matthew Wild
3 -- Copyright (C) 2008-2010 Waqas Hussain
5 -- This project is MIT/X11 licensed. Please see the
6 -- COPYING file in the source package for more information.
9 local st = require "util.stanza";
11 module:add_feature("jabber:iq:version");
13 local version = "the best operating system ever!";
15 if not module:get_option("hide_os_type") then
16 if os.getenv("WINDIR") then
19 local uname = io.popen("uname");
21 version = uname:read("*a");
28 version = version:match("^%s*(.-)%s*$") or version;
30 local query = st.stanza("query", {xmlns = "jabber:iq:version"})
31 :tag("name"):text("Prosody"):up()
32 :tag("version"):text(prosody.version):up()
33 :tag("os"):text(version);
35 module:hook("iq/host/jabber:iq:version:query", function(event)
36 local stanza = event.stanza;
37 if stanza.attr.type == "get" and stanza.attr.to == module.host then
38 event.origin.send(st.reply(stanza):add_child(query));