# HG changeset patch # User Matthew Wild # Date 1245992095 -3600 # Node ID 1576a5aa52f8ccc6f1fe24eb15f9154241bb70a6 # Parent 1ac8bcc63a9d924b62746a478960429e84271928 util.stanza: Add stanza:get_text() to retrieve all child text nodes #api diff -r 1ac8bcc63a9d -r 1576a5aa52f8 util/stanza.lua --- a/util/stanza.lua Fri Jun 26 05:54:03 2009 +0100 +++ b/util/stanza.lua Fri Jun 26 05:54:55 2009 +0100 @@ -158,6 +158,12 @@ 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