aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-21 23:20:26 +0100
committerKim Alvefur <zash@zash.se>2018-03-21 23:20:26 +0100
commit2d784f106343913767108ba9b099323d20e0b67f (patch)
tree0b8d2066e9f4aafc9ed391d0e66fc73f5f7bc2e9
parent5535272ff7a5fb0846dbb0d9347b639d223e2f49 (diff)
downloadprosody-2d784f106343913767108ba9b099323d20e0b67f.tar.gz
prosody-2d784f106343913767108ba9b099323d20e0b67f.zip
util.stanza: Add :text_tag(), a shortcut for adding nodes with text
-rw-r--r--util/stanza.lua4
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;