# HG changeset patch # User Kim Alvefur # Date 1341503927 -7200 # Node ID 92c86e11fd44b9ea9902c85cc8317ebe73b082e4 # Parent bc62abceef07ff507d0fac80c229aef5f550e46a util.stanza: Make stanza:childtags() behave like :get_child() diff -r bc62abceef07 -r 92c86e11fd44 util/stanza.lua --- a/util/stanza.lua Tue Jul 03 15:56:32 2012 +0200 +++ b/util/stanza.lua Thu Jul 05 17:58:47 2012 +0200 @@ -133,14 +133,14 @@ end function stanza_mt:childtags(name, xmlns) - xmlns = xmlns or self.attr.xmlns; local tags = self.tags; local start_i, max_i = 1, #tags; return function () for i = start_i, max_i do local v = tags[i]; if (not name or v.name == name) - and (not xmlns or xmlns == v.attr.xmlns) then + and ((not xmlns and self.attr.xmlns == v.attr.xmlns) + or v.attr.xmlns == xmlns) then start_i = i+1; return v; end