summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-02 01:55:34 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-02 01:55:34 +0200
commit5483cd40ee1e84e86bfe775ba06ca9d7d5d5a0ea (patch)
treed19eab80fbab8c0676f363ba65168979cab5d122
parent29b10b6c2be620684e5892f821b69727a7fb07f7 (diff)
downloadpoezio-5483cd40ee1e84e86bfe775ba06ca9d7d5d5a0ea.tar.gz
poezio-5483cd40ee1e84e86bfe775ba06ca9d7d5d5a0ea.tar.bz2
poezio-5483cd40ee1e84e86bfe775ba06ca9d7d5d5a0ea.tar.xz
poezio-5483cd40ee1e84e86bfe775ba06ca9d7d5d5a0ea.zip
Switch from @asyncio.coroutine to async def everywhere.
-rw-r--r--poezio/core/handlers.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index d34534d0..d950491d 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -382,8 +382,7 @@ class HandlerCore:
else:
self.core.refresh_window()
- @asyncio.coroutine
- def on_0084_avatar(self, msg):
+ async def on_0084_avatar(self, msg):
jid = msg['from'].bare
contact = roster[jid]
if not contact:
@@ -408,7 +407,7 @@ class HandlerCore:
# If we didn’t have any, query the data instead.
if not info['url']:
try:
- result = yield from self.core.xmpp[
+ result = await self.core.xmpp[
'xep_0084'].retrieve_avatar(
jid, avatar_hash, timeout=60)
avatar = result['pubsub']['items']['item']['avatar_data'][
@@ -432,8 +431,7 @@ class HandlerCore:
exc_info=True)
return
- @asyncio.coroutine
- def on_vcard_avatar(self, pres):
+ async def on_vcard_avatar(self, pres):
jid = pres['from'].bare
contact = roster[jid]
if not contact:
@@ -450,7 +448,7 @@ class HandlerCore:
# If we didn’t have any, query the vCard instead.
try:
- result = yield from self.core.xmpp['xep_0054'].get_vcard(
+ result = await self.core.xmpp['xep_0054'].get_vcard(
jid, cached=True, timeout=60)
avatar = result['vcard_temp']['PHOTO']
binval = avatar['BINVAL']
@@ -1140,8 +1138,7 @@ class HandlerCore:
self.core.information("Connection to remote server failed: %s" %
(error, ), 'Error')
- @asyncio.coroutine
- def on_disconnected(self, event):
+ async def on_disconnected(self, event):
"""
When we are disconnected from remote server
"""
@@ -1162,7 +1159,7 @@ class HandlerCore:
and self.core.last_stream_error[1]['condition'] in (
'conflict', 'host-unknown')):
return
- yield from asyncio.sleep(1)
+ await asyncio.sleep(1)
self.core.information("Auto-reconnecting.", 'Info')
self.core.xmpp.start()