projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e644f26
)
Add child_with_ns() method to stanza elements, and fix child_with_name() to iterate...
author
Matthew Wild
<mwild1@gmail.com>
Sun, 11 Jan 2009 06:27:57 +0000
(06:27 +0000)
committer
Matthew Wild
<mwild1@gmail.com>
Sun, 11 Jan 2009 06:27:57 +0000
(06:27 +0000)
util/stanza.lua
patch
|
blob
|
history
diff --git
a/util/stanza.lua
b/util/stanza.lua
index c4cecb6f9e36984af4e98c093acb04ab0d29ea9c..14a8f395774530aa918d14ca220021db8c03199a 100644
(file)
--- a/
util/stanza.lua
+++ b/
util/stanza.lua
@@
-87,11
+87,17
@@
function stanza_mt:add_child(child)
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)