From 49f2cc3baa5af738740f6c185865efe5635eb303 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 26 Jun 2009 05:54:55 +0100 Subject: util.stanza: Add stanza:get_text() to retrieve all child text nodes #api --- util/stanza.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'util') diff --git a/util/stanza.lua b/util/stanza.lua index aff0bfc7..eb9f3922 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -158,6 +158,12 @@ function stanza_mt.top_tag(t) return s_format("<%s%s>", t.name, attr_string); end +function stanza_mt.get_text(t) + if #t.tags == 0 then + return t_concat(t); + end +end + function stanza_mt.__add(s1, s2) return s1:add_direct_child(s2); end -- cgit v1.2.3