# HG changeset patch # User Goffi # Date 1429308790 -7200 # Node ID e22cd2205fc10ea1821f64e9de9bb295de403e9c # Parent 29dfdfc767b460be702590f3374a9ee7dd9f8b77 mod_delegation: reset features/identities/extensions before doing a disco nesting diff -r 29dfdfc767b4 -r e22cd2205fc1 mod_delegation/mod_delegation.lua --- a/mod_delegation/mod_delegation.lua Sat Apr 18 00:13:09 2015 +0200 +++ b/mod_delegation/mod_delegation.lua Sat Apr 18 00:13:10 2015 +0200 @@ -370,9 +370,7 @@ for feature in query:childtags("feature") do local namespace = feature.attr.var if main then - if not module:has_feature(namespace) then -- we avoid doubling features in case of disconnection/reconnexion - module:add_feature(namespace) - end + module:add_feature(namespace) else bare_features:add(namespace) end @@ -380,20 +378,9 @@ for identity in query:childtags("identity") do local category, type_, name = identity.attr.category, identity.attr.type, identity.attr.name if main then - if not module:has_identity(category, type_, name) then - module:add_identity(category, type_, name) - end + module:add_identity(category, type_, name) else - local found=false - for _, item in ipairs(bare_identities) do - if item.category == category and item.type == type_ and item.name == name then - found=true - break - end - end - if not found then - table.insert(bare_identities, {category=category, type=type_, name=name}) - end + table.insert(bare_identities, {category=category, type=type_, name=name}) end end for extension in query:childtags("x", _DATA_NS) do @@ -418,6 +405,18 @@ end function disco_nest(namespace, entity_jid) + -- manage discovery nesting (see ยง 7.2) + + -- first we reset the current values + if module.items then + module.items['feature'] = nil + module.items['identity'] = nil + module.items['extension'] = nil + bare_features = set.new() + bare_identities = {} + bare_extensions = {} + end + for _, prefix in ipairs(_PREFIXES) do local node = prefix..namespace