# HG changeset patch # User Matthew Wild # Date 1231655277 0 # Node ID 94b043fbaf33a8480e80d3b1f93083edffddc799 # Parent 5f77bbc1f04a3822836146400d3ffbfbb67cb739 Add child_with_ns() method to stanza elements, and fix child_with_name() to iterate tags rather than all children diff -r 5f77bbc1f04a -r 94b043fbaf33 util/stanza.lua --- 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)