diff options
Diffstat (limited to 'util/stanza.lua')
-rw-r--r-- | util/stanza.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/util/stanza.lua b/util/stanza.lua index 6af7e2b2..14a8f395 100644 --- 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) @@ -199,6 +205,9 @@ function deserialize(stanza) end end stanza.tags = tags; + if not stanza.last_add then + stanza.last_add = {}; + end end end |