aboutsummaryrefslogtreecommitdiffstats
path: root/util/stanza.lua
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2009-11-30 23:25:10 +0100
committerTobias Markmann <tm@ayena.de>2009-11-30 23:25:10 +0100
commit37ace9243be47afe89013bc44912af491f9b1d9b (patch)
tree052db778333769cbf84a469d86c3933212573213 /util/stanza.lua
parent4d1368b58f7aafa6593bcff2d9684441e09fbc4d (diff)
parent2100104326791787aafc14012c731e54ed4c35fa (diff)
downloadprosody-37ace9243be47afe89013bc44912af491f9b1d9b.tar.gz
prosody-37ace9243be47afe89013bc44912af491f9b1d9b.zip
Merge with tip.
Diffstat (limited to 'util/stanza.lua')
-rw-r--r--util/stanza.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index d295d5cc..8d3b7747 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -93,6 +93,17 @@ function stanza_mt:add_child(child)
return self;
end
+function stanza_mt:get_child(name, xmlns)
+ for _, child in ipairs(self.tags) do
+ if (not name or child.name == name)
+ and ((not xmlns and self.attr.xmlns == child.attr.xmlns)
+ or child.attr.xmlns == xmlns) then
+
+ return child;
+ end
+ end
+end
+
function stanza_mt:child_with_name(name)
for _, child in ipairs(self.tags) do
if child.name == name then return child; end