aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_version.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2010-08-01 15:58:10 +0200
committerKim Alvefur <zash@zash.se>2010-08-01 15:58:10 +0200
commit42ddba6e98be637ed45249271cf803c4705e3629 (patch)
tree32badf7a3d01d597ceaa1221e8a007af80fa4f12 /plugins/mod_version.lua
parent9b900ecc5f0733f848655f39c6d49f2d0f6dc9f4 (diff)
downloadprosody-42ddba6e98be637ed45249271cf803c4705e3629.tar.gz
prosody-42ddba6e98be637ed45249271cf803c4705e3629.zip
mod_version: Leave out the os element if hide_os_type is set
Diffstat (limited to 'plugins/mod_version.lua')
-rw-r--r--plugins/mod_version.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/mod_version.lua b/plugins/mod_version.lua
index a34ce6f2..f3c5c190 100644
--- a/plugins/mod_version.lua
+++ b/plugins/mod_version.lua
@@ -12,6 +12,10 @@ module:add_feature("jabber:iq:version");
local version = "the best operating system ever!";
+local query = st.stanza("query", {xmlns = "jabber:iq:version"})
+ :tag("name"):text("Prosody"):up()
+ :tag("version"):text(prosody.version):up();
+
if not module:get_option("hide_os_type") then
if os.getenv("WINDIR") then
version = "Windows";
@@ -23,15 +27,10 @@ if not module:get_option("hide_os_type") then
version = "an OS";
end
end
+ version = version:match("^%s*(.-)%s*$") or version;
+ query:tag("os"):text(version):up();
end
-version = version:match("^%s*(.-)%s*$") or version;
-
-local query = st.stanza("query", {xmlns = "jabber:iq:version"})
- :tag("name"):text("Prosody"):up()
- :tag("version"):text(prosody.version):up()
- :tag("os"):text(version);
-
module:hook("iq/host/jabber:iq:version:query", function(event)
local stanza = event.stanza;
if stanza.attr.type == "get" and stanza.attr.to == module.host then