diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-06-26 05:54:55 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-06-26 05:54:55 +0100 |
commit | 49f2cc3baa5af738740f6c185865efe5635eb303 (patch) | |
tree | a9d2f3c3dfb2081e759ce2ef508af28665e8237a /util | |
parent | ccec4fa3dfc7e6ae63bdec101448771499d00ea9 (diff) | |
download | prosody-49f2cc3baa5af738740f6c185865efe5635eb303.tar.gz prosody-49f2cc3baa5af738740f6c185865efe5635eb303.zip |
util.stanza: Add stanza:get_text() to retrieve all child text nodes #api
Diffstat (limited to 'util')
-rw-r--r-- | util/stanza.lua | 6 |
1 files changed, 6 insertions, 0 deletions
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 |