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 query
= st
.stanza("query", {xmlns
= "jabber:iq:version"})
14 :text_tag("name", "Prosody")
15 :text_tag("version", prosody
.version
);
17 if not module
:get_option_boolean("hide_os_type") then
19 if os
.getenv("WINDIR") then
22 local os_version_command
= module
:get_option_string("os_version_command");
23 local ok
, pposix
= pcall(require
, "util.pposix");
24 if not os_version_command
and (ok
and pposix
and pposix
.uname
) then
25 platform
= pposix
.uname().sysname
;
28 local uname
= io
.popen(os_version_command
or "uname");
30 platform
= uname
:read("*a");
36 platform
= platform
:match("^%s*(.-)%s*$") or platform
;
37 query
:text_tag("os", platform
);
41 module
:hook("iq-get/host/jabber:iq:version:query", function(event
)
42 local origin
, stanza
= event
.origin
, event
.stanza
;
43 origin
.send(st
.reply(stanza
):add_child(query
));