aboutsummaryrefslogtreecommitdiffstats
path: root/util/stanza.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-01-11 06:27:57 +0000
committerMatthew Wild <mwild1@gmail.com>2009-01-11 06:27:57 +0000
commit937375dda1377019b4f592b6f9cea9103cdbd967 (patch)
tree7111c5f7291448439ca40748995dd04986afa11a /util/stanza.lua
parentfa0e1edd87a3224e998fd4bad37c03c9d2bfe027 (diff)
downloadprosody-937375dda1377019b4f592b6f9cea9103cdbd967.tar.gz
prosody-937375dda1377019b4f592b6f9cea9103cdbd967.zip
Add child_with_ns() method to stanza elements, and fix child_with_name() to iterate tags rather than all children
Diffstat (limited to 'util/stanza.lua')
-rw-r--r--util/stanza.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index c4cecb6f..14a8f395 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -87,11 +87,17 @@ function stanza_mt:add_child(child)
end
function stanza_mt:child_with_name(name)
- for _, child in ipairs(self) do
+ for _, child in ipairs(self.tags) do
if child.name == name then return child; end
end
end
+function stanza_mt:child_with_ns(ns)
+ for _, child in ipairs(self.tags) do
+ if child.attr.xmlns == ns then return child; end
+ end
+end
+
function stanza_mt:children()
local i = 0;
return function (a)