diff options
Diffstat (limited to 'slixmpp/plugins/xep_0363/http_upload.py')
-rw-r--r-- | slixmpp/plugins/xep_0363/http_upload.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/slixmpp/plugins/xep_0363/http_upload.py b/slixmpp/plugins/xep_0363/http_upload.py index 0cca2d08..65894975 100644 --- a/slixmpp/plugins/xep_0363/http_upload.py +++ b/slixmpp/plugins/xep_0363/http_upload.py @@ -68,16 +68,10 @@ class XEP_0363(BasePlugin): def _handle_request(self, iq): self.xmpp.event('http_upload_request', iq) - async def find_upload_service(self, ifrom=None, timeout=None, callback=None, - timeout_callback=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() + async def find_upload_service(self, timeout=None): + results = await self.xmpp['xep_0030'].get_info_from_domain() + + for info in results: for identity in info['disco_info']['identities']: if identity[0] == 'store' and identity[1] == 'file': return info @@ -100,7 +94,7 @@ class XEP_0363(BasePlugin): callback=None, timeout_callback=None): ''' Helper function which does all of the uploading process. ''' if self.upload_service is None: - info_iq = await self.find_upload_service(ifrom=ifrom, timeout=timeout) + info_iq = await self.find_upload_service(timeout=timeout) if info_iq is None: raise UploadServiceNotFound() self.upload_service = info_iq['from'] |