diff options
author | Kim Alvefur <zash@zash.se> | 2018-07-08 19:12:17 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-07-08 19:12:17 +0200 |
commit | 3247d46c823fc8ab113fb66bd405b1762a16909c (patch) | |
tree | 8149a83b8082869e08583bd1e4f20256c8e3f3ca | |
parent | f91c907f94bc2d91c733a08a9cd5a58a304d1f8f (diff) | |
parent | 10cf2b24e6554da98a320842b700798dd58cb149 (diff) | |
download | prosody-3247d46c823fc8ab113fb66bd405b1762a16909c.tar.gz prosody-3247d46c823fc8ab113fb66bd405b1762a16909c.zip |
Merge 0.10->trunk
-rw-r--r-- | util/stanza.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua index 1f67c75b..11398179 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -149,6 +149,16 @@ function stanza_mt:add_child(child) return self; end +function stanza_mt:remove_children(name, xmlns) + xmlns = xmlns or self.attr.xmlns; + return self:maptags(function (tag) + if (not name or tag.name == name) and tag.attr.xmlns == xmlns then + return nil; + end + return tag; + end); +end + function stanza_mt:get_child(name, xmlns) for _, child in ipairs(self.tags) do if (not name or child.name == name) |