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 | a4d7a083175658591a6a61a9716da3693ee7bbc1 (patch) | |
tree | 8149a83b8082869e08583bd1e4f20256c8e3f3ca /util/stanza.lua | |
parent | d3db6ff3baeb1e8b4e8ff442b000c594d22b2645 (diff) | |
parent | 759fe72f49e08114f36d880e60e64e77781e4c59 (diff) | |
download | prosody-a4d7a083175658591a6a61a9716da3693ee7bbc1.tar.gz prosody-a4d7a083175658591a6a61a9716da3693ee7bbc1.zip |
Merge 0.10->trunk
Diffstat (limited to 'util/stanza.lua')
-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) |