From 1158e804713b8159712d60179a524f4dad4ef0f1 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 21 Mar 2018 23:20:26 +0100 Subject: util.stanza: Add :text_tag(), a shortcut for adding nodes with text --- util/stanza.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'util/stanza.lua') 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; -- cgit v1.2.3