aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-07-08 19:12:17 +0200
committerKim Alvefur <zash@zash.se>2018-07-08 19:12:17 +0200
commita4d7a083175658591a6a61a9716da3693ee7bbc1 (patch)
tree8149a83b8082869e08583bd1e4f20256c8e3f3ca
parentd3db6ff3baeb1e8b4e8ff442b000c594d22b2645 (diff)
parent759fe72f49e08114f36d880e60e64e77781e4c59 (diff)
downloadprosody-a4d7a083175658591a6a61a9716da3693ee7bbc1.tar.gz
prosody-a4d7a083175658591a6a61a9716da3693ee7bbc1.zip
Merge 0.10->trunk
-rw-r--r--util/stanza.lua10
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)