Sun, 11 Jan 2009 06:27:57 +0000
Add child_with_ns() method to stanza elements, and fix child_with_name() to iterate tags rather than all children
util/stanza.lua | file | annotate | diff | comparison | revisions |
--- a/util/stanza.lua Fri Jan 09 19:19:06 2009 +0000 +++ b/util/stanza.lua Sun Jan 11 06:27:57 2009 +0000 @@ -87,11 +87,17 @@ 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)