core (memory/disco): fixed types of disco extensions:
typeCheck() is not automatically called on reception by Wokkel, as a result extensions fields values may be strings instead of the field type. TypeCheck is now explicitly called in memory.disco to avoid that. It is not called immediately on reception as the string value is needed to calculate the capability hash
This commit is contained in:
parent
7201730938
commit
83260b827a
1 changed files with 10 additions and 1 deletions
|
|
@ -87,6 +87,9 @@ class HashManager(object):
|
|||
for hash_, xml in hashes.items():
|
||||
element = xml_tools.ElementParser()(xml)
|
||||
disco_info = disco.DiscoInfo.fromElement(element)
|
||||
for ext_form in disco_info.extensions.values():
|
||||
# wokkel doesn't call typeCheck on reception, so we do it here
|
||||
ext_form.typeCheck()
|
||||
if not disco_info.features and not disco_info.identities:
|
||||
log.warning(
|
||||
_(
|
||||
|
|
@ -180,6 +183,12 @@ class Discovery(object):
|
|||
# capability hash is not available, we'll compute one
|
||||
def infosCb(disco_infos):
|
||||
cap_hash = self.generateHash(disco_infos)
|
||||
for ext_form in disco_infos.extensions.values():
|
||||
# wokkel doesn't call typeCheck on reception, so we do it here
|
||||
# to avoid ending up with incorrect types. We have to do it after
|
||||
# the hash has been generated (str value is needed to compute the
|
||||
# hash)
|
||||
ext_form.typeCheck()
|
||||
self.hashes[cap_hash] = disco_infos
|
||||
self.host.memory.updateEntityData(
|
||||
jid_, C.ENTITY_CAP_HASH, cap_hash, profile_key=client.profile
|
||||
|
|
@ -405,7 +414,7 @@ class Discovery(object):
|
|||
def _discoInfos(
|
||||
self, entity_jid_s, node="", use_cache=True, profile_key=C.PROF_KEY_NONE
|
||||
):
|
||||
""" Discovery method for the bridge
|
||||
"""Discovery method for the bridge
|
||||
@param entity_jid_s: entity we want to discover
|
||||
@param use_cache(bool): if True, use cached data if available
|
||||
@param node(unicode): optional node to use
|
||||
|
|
|
|||
Loading…
Reference in a new issue