diff options
author | Kim Alvefur <zash@zash.se> | 2018-03-21 23:20:26 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-03-21 23:20:26 +0100 |
commit | 1158e804713b8159712d60179a524f4dad4ef0f1 (patch) | |
tree | 0b8d2066e9f4aafc9ed391d0e66fc73f5f7bc2e9 /util | |
parent | 1bddd78cbdd576301124a8b4e17b46502eb3ae1f (diff) | |
download | prosody-1158e804713b8159712d60179a524f4dad4ef0f1.tar.gz prosody-1158e804713b8159712d60179a524f4dad4ef0f1.zip |
util.stanza: Add :text_tag(), a shortcut for adding nodes with text
Diffstat (limited to 'util')
-rw-r--r-- | util/stanza.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua index 4a0a9ce8..4f91d5e9 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -101,6 +101,10 @@ function stanza_mt:body(text, attr) return self:tag("body", attr):text(text); end +function stanza_mt:text_tag(name, text, attr, namespaces) + return self:tag(name, attr, namespaces):text(text):up(); +end + function stanza_mt:tag(name, attr, namespaces) local s = new_stanza(name, attr, namespaces); local last_add = self.last_add; |