Software / code / prosody
Changeset
1420:1576a5aa52f8
util.stanza: Add stanza:get_text() to retrieve all child text nodes #api
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 26 Jun 2009 05:54:55 +0100 |
| parents | 1419:1ac8bcc63a9d |
| children | 1421:7dafb3bae02b |
| files | util/stanza.lua |
| diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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