Software /
code /
prosody
Diff
util/stanza.lua @ 8999:a2a4c225a3f8
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 08 Jul 2018 19:12:17 +0200 |
parent | 8894:7273fb6af831 |
parent | 8998:6bddc90eeb27 |
child | 9217:7df29c5fbb9b |
line wrap: on
line diff
--- a/util/stanza.lua Sun Jul 08 04:17:54 2018 +0200 +++ b/util/stanza.lua Sun Jul 08 19:12:17 2018 +0200 @@ -149,6 +149,16 @@ 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)