From 42ddba6e98be637ed45249271cf803c4705e3629 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 1 Aug 2010 15:58:10 +0200 Subject: mod_version: Leave out the os element if hide_os_type is set --- plugins/mod_version.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'plugins/mod_version.lua') 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 -- cgit v1.2.3