util.stanza: Add stanza:get_text() to retrieve all child text nodes #api
authorMatthew Wild <mwild1@gmail.com>
Fri, 26 Jun 2009 04:54:55 +0000 (05:54 +0100)
committerMatthew Wild <mwild1@gmail.com>
Fri, 26 Jun 2009 04:54:55 +0000 (05:54 +0100)
util/stanza.lua

index aff0bfc7df7b989b6e1045cddb0f7ee675b03195..eb9f392209d78b6ea60c53f95def5026645bbbec 100644 (file)
@@ -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