Software / code / prosody
Comparison
util/stanza.lua @ 4940:39781d4d3173
Merge 0.9->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 05 Jul 2012 17:40:12 +0100 |
| parent | 4936:92c86e11fd44 |
| child | 5090:61c7c53c06d5 |
comparison
equal
deleted
inserted
replaced
| 4932:212e81ac6ebb | 4940:39781d4d3173 |
|---|---|
| 131 return a[i]; | 131 return a[i]; |
| 132 end, self, i; | 132 end, self, i; |
| 133 end | 133 end |
| 134 | 134 |
| 135 function stanza_mt:childtags(name, xmlns) | 135 function stanza_mt:childtags(name, xmlns) |
| 136 xmlns = xmlns or self.attr.xmlns; | |
| 137 local tags = self.tags; | 136 local tags = self.tags; |
| 138 local start_i, max_i = 1, #tags; | 137 local start_i, max_i = 1, #tags; |
| 139 return function () | 138 return function () |
| 140 for i = start_i, max_i do | 139 for i = start_i, max_i do |
| 141 local v = tags[i]; | 140 local v = tags[i]; |
| 142 if (not name or v.name == name) | 141 if (not name or v.name == name) |
| 143 and (not xmlns or xmlns == v.attr.xmlns) then | 142 and ((not xmlns and self.attr.xmlns == v.attr.xmlns) |
| 143 or v.attr.xmlns == xmlns) then | |
| 144 start_i = i+1; | 144 start_i = i+1; |
| 145 return v; | 145 return v; |
| 146 end | 146 end |
| 147 end | 147 end |
| 148 end; | 148 end; |