Factor out fetching of identities in xep_0363 to xep_0030

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet
2018-06-09 15:55:12 +01:00
parent b881c6729b
commit 037706552c
2 changed files with 30 additions and 11 deletions
+3 -11
View File
@@ -69,17 +69,9 @@ class XEP_0363(BasePlugin):
self.xmpp.event('http_upload_request', iq)
async def find_upload_service(self, timeout=None):
infos = [self.xmpp['xep_0030'].get_info(self.xmpp.boundjid.domain)]
iq_items = await self.xmpp['xep_0030'].get_items(
self.xmpp.boundjid.domain, timeout=timeout)
items = iq_items['disco_items']['items']
infos += [self.xmpp['xep_0030'].get_info(item[0]) for item in items]
info_futures, _ = await asyncio.wait(infos, timeout=timeout)
for future in info_futures:
info = future.result()
for identity in info['disco_info']['identities']:
if identity[0] == 'store' and identity[1] == 'file':
return info
results = await self.xmpp['xep_0030'].find_identities('store', 'file')
if results:
return results[0]
def request_slot(self, jid, filename, size, content_type=None, ifrom=None,
timeout=None, callback=None, timeout_callback=None):