aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-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)