aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-07-05 17:58:47 +0200
committerKim Alvefur <zash@zash.se>2012-07-05 17:58:47 +0200
commitae0fdd43a4248bda8d1f3d01ab592dff0412b574 (patch)
tree13ec3368d7bff3b1ac391360be68b20569a44bba
parent92a51d69e913aca81c39b98a9c79751ee97f24e8 (diff)
downloadprosody-ae0fdd43a4248bda8d1f3d01ab592dff0412b574.tar.gz
prosody-ae0fdd43a4248bda8d1f3d01ab592dff0412b574.zip
util.stanza: Make stanza:childtags() behave like :get_child()
-rw-r--r--util/stanza.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 1449f707..5c430f1d 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -133,14 +133,14 @@ function stanza_mt:children()
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