# HG changeset patch # User Kim Alvefur # Date 1280671090 -7200 # Node ID d3852a4d37e268ad6b6ce75844c80e2097303752 # Parent 9be46a3466efd4ec161a69bf3885fab96b5bd9b2 mod_version: Leave out the os element if hide_os_type is set diff -r 9be46a3466ef -r d3852a4d37e2 plugins/mod_version.lua --- a/plugins/mod_version.lua Sun Aug 01 15:56:52 2010 +0200 +++ b/plugins/mod_version.lua Sun Aug 01 15:58:10 2010 +0200 @@ -12,6 +12,10 @@ 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 @@ 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