Software /
code /
prosody
Diff
plugins/mod_version.lua @ 3421:d3852a4d37e2
mod_version: Leave out the os element if hide_os_type is set
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 01 Aug 2010 15:58:10 +0200 |
parent | 3420:9be46a3466ef |
child | 3483:443139c396c5 |
line wrap: on
line diff
--- 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