aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-06-26 05:54:55 +0100
committerMatthew Wild <mwild1@gmail.com>2009-06-26 05:54:55 +0100
commit49f2cc3baa5af738740f6c185865efe5635eb303 (patch)
treea9d2f3c3dfb2081e759ce2ef508af28665e8237a /util
parentccec4fa3dfc7e6ae63bdec101448771499d00ea9 (diff)
downloadprosody-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.lua6
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