Merge branch 'xep0363-as-component' into 'master'

XEP-0363: Fix upload service auto discovery for components

See merge request poezio/slixmpp!207
This commit is contained in:
mathieui 2022-09-09 16:07:46 +00:00
commit afdfa1ee57

View file

@ -101,12 +101,17 @@ class XEP_0363(BasePlugin):
:param domain: Domain to disco to find a service. :param domain: Domain to disco to find a service.
""" """
if domain is None and self.xmpp.is_component:
domain = self.xmpp.server_host
results = await self.xmpp['xep_0030'].get_info_from_domain( results = await self.xmpp['xep_0030'].get_info_from_domain(
domain=domain, **iqkwargs domain=domain, **iqkwargs
) )
candidates = [] candidates = []
for info in results: for info in results:
if not info['disco_info']:
continue
for identity in info['disco_info']['identities']: for identity in info['disco_info']['identities']:
if identity[0] == 'store' and identity[1] == 'file': if identity[0] == 'store' and identity[1] == 'file':
candidates.append(info) candidates.append(info)