diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-02-22 07:37:52 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-02-22 07:37:52 +0000 |
commit | 24d55e89f01988529b85ec87f5a4a9e76b0b8ee6 (patch) | |
tree | 82be2999f934b7fbaf76fe7f5a1a09f8771ec582 | |
parent | ef64f191850e03c0590e36eec6a4764d93e8163b (diff) | |
download | prosody-24d55e89f01988529b85ec87f5a4a9e76b0b8ee6.tar.gz prosody-24d55e89f01988529b85ec87f5a4a9e76b0b8ee6.zip |
util.stanza: Remove childtags and rename matching_tags -> childtags (they are API-compatible)
-rw-r--r-- | util/stanza.lua | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/util/stanza.lua b/util/stanza.lua index bf944115..de83977f 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -138,29 +138,20 @@ function stanza_mt:children() end, self, i; end -function stanza_mt:matching_tags(name, xmlns) +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 - v = tags[i]; - if (not name or v.name == name) - and (not xmlns or xmlns == v.attr.xmlns) then - start_i = i+1; - return v; - end + 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 + start_i = i+1; + return v; end - end, tags, i; -end - -function stanza_mt:childtags() - local i = 0; - return function (a) - i = i + 1 - local v = self.tags[i] - if v then return v; end - end, self.tags[1], i; + end + end; end function stanza_mt:maptags(callback) |