XEP-0363: Fix upload service auto discovery for components

This commit is contained in:
Nicolas Cedilnik 2022-06-18 06:09:36 +02:00
parent 5ceb48bbcd
commit afb5419b68

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)