diff options
author | Maxime “pep” Buquet <pep@bouah.net> | 2018-06-09 15:55:12 +0100 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2018-07-01 01:29:31 +0100 |
commit | 037706552c68ec900475633af0474a7cdac29814 (patch) | |
tree | 5beb821c162e652f20f86cbe53f1b58fcfda1026 /slixmpp/plugins/xep_0363 | |
parent | b881c6729b79e37aba5ab2d99c3ba0fd79bc1b76 (diff) | |
download | slixmpp-037706552c68ec900475633af0474a7cdac29814.tar.gz slixmpp-037706552c68ec900475633af0474a7cdac29814.tar.bz2 slixmpp-037706552c68ec900475633af0474a7cdac29814.tar.xz slixmpp-037706552c68ec900475633af0474a7cdac29814.zip |
Factor out fetching of identities in xep_0363 to xep_0030
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'slixmpp/plugins/xep_0363')
-rw-r--r-- | slixmpp/plugins/xep_0363/http_upload.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/slixmpp/plugins/xep_0363/http_upload.py b/slixmpp/plugins/xep_0363/http_upload.py index 073b3fc0..3c0f2b3e 100644 --- a/slixmpp/plugins/xep_0363/http_upload.py +++ b/slixmpp/plugins/xep_0363/http_upload.py @@ -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): |