Mercurial > prosody-hg
comparison plugins/mod_version.lua @ 9433:13b8d47119ad
mod_version: Use text_tag
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 06 Oct 2018 16:27:31 +0200 |
| parents | 1338b84c0566 |
| children | b502766a10d7 |
comparison
equal
deleted
inserted
replaced
| 9432:2e3f66475cc8 | 9433:13b8d47119ad |
|---|---|
| 11 module:add_feature("jabber:iq:version"); | 11 module:add_feature("jabber:iq:version"); |
| 12 | 12 |
| 13 local version; | 13 local version; |
| 14 | 14 |
| 15 local query = st.stanza("query", {xmlns = "jabber:iq:version"}) | 15 local query = st.stanza("query", {xmlns = "jabber:iq:version"}) |
| 16 :tag("name"):text("Prosody"):up() | 16 :text_tag("name", "Prosody") |
| 17 :tag("version"):text(prosody.version):up(); | 17 :text_tag("version", prosody.version); |
| 18 | 18 |
| 19 if not module:get_option_boolean("hide_os_type") then | 19 if not module:get_option_boolean("hide_os_type") then |
| 20 if os.getenv("WINDIR") then | 20 if os.getenv("WINDIR") then |
| 21 version = "Windows"; | 21 version = "Windows"; |
| 22 else | 22 else |
| 33 uname:close(); | 33 uname:close(); |
| 34 end | 34 end |
| 35 end | 35 end |
| 36 if version then | 36 if version then |
| 37 version = version:match("^%s*(.-)%s*$") or version; | 37 version = version:match("^%s*(.-)%s*$") or version; |
| 38 query:tag("os"):text(version):up(); | 38 query:text_tag("os", version); |
| 39 end | 39 end |
| 40 end | 40 end |
| 41 | 41 |
| 42 module:hook("iq-get/host/jabber:iq:version:query", function(event) | 42 module:hook("iq-get/host/jabber:iq:version:query", function(event) |
| 43 local stanza = event.stanza; | 43 local stanza = event.stanza; |
