summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/exec.py2
-rw-r--r--plugins/irc.py2
-rw-r--r--plugins/ping.py6
-rw-r--r--plugins/upload.py2
-rw-r--r--plugins/user_extras.py9
-rw-r--r--plugins/vcard.py8
-rw-r--r--poezio/core/commands.py16
-rw-r--r--poezio/core/core.py2
-rw-r--r--poezio/core/handlers.py4
-rw-r--r--poezio/fixes.py2
-rw-r--r--poezio/log_loader.py2
-rw-r--r--poezio/multiuserchat.py2
-rw-r--r--poezio/tabs/basetabs.py8
-rw-r--r--poezio/tabs/bookmarkstab.py2
-rw-r--r--poezio/tabs/muctab.py8
15 files changed, 36 insertions, 39 deletions
diff --git a/plugins/exec.py b/plugins/exec.py
index 0786c86f..68f24486 100644
--- a/plugins/exec.py
+++ b/plugins/exec.py
@@ -95,4 +95,4 @@ class Plugin(BasePlugin):
else:
self.api.run_command('/help exec')
return
- asyncio.ensure_future(self.async_exec(command, arg))
+ asyncio.create_task(self.async_exec(command, arg))
diff --git a/plugins/irc.py b/plugins/irc.py
index a7650ec4..d732c127 100644
--- a/plugins/irc.py
+++ b/plugins/irc.py
@@ -141,7 +141,7 @@ from poezio import tabs
class Plugin(BasePlugin):
def init(self):
if self.config.get('initial_connect', True):
- asyncio.ensure_future(
+ asyncio.create_task(
self.initial_connect()
)
diff --git a/plugins/ping.py b/plugins/ping.py
index 46ce4efc..cc987bf0 100644
--- a/plugins/ping.py
+++ b/plugins/ping.py
@@ -123,7 +123,7 @@ class Plugin(BasePlugin):
jid = arg
if not arg:
jid = self.api.current_tab().jid
- asyncio.ensure_future(
+ asyncio.create_task(
self.command_ping(jid)
)
@@ -140,7 +140,7 @@ class Plugin(BasePlugin):
jid = JID(arg)
except InvalidJID:
return self.api.information('Invalid JID: %s' % arg, 'Error')
- asyncio.ensure_future(
+ asyncio.create_task(
self.command_ping(jid.full)
)
@@ -156,7 +156,7 @@ class Plugin(BasePlugin):
res = current.get_highest_priority_resource()
if res is not None:
jid =res.jid
- asyncio.ensure_future(
+ asyncio.create_task(
self.command_ping(jid)
)
diff --git a/plugins/upload.py b/plugins/upload.py
index c702dc49..9a70a965 100644
--- a/plugins/upload.py
+++ b/plugins/upload.py
@@ -78,7 +78,7 @@ class Plugin(BasePlugin):
return
filename, = args
filename = expanduser(filename)
- asyncio.ensure_future(self.send_upload(filename))
+ asyncio.create_task(self.send_upload(filename))
@staticmethod
def completion_filename(the_input):
diff --git a/plugins/user_extras.py b/plugins/user_extras.py
index ad49a142..96559111 100644
--- a/plugins/user_extras.py
+++ b/plugins/user_extras.py
@@ -91,10 +91,7 @@ Configuration
"""
-from asyncio import (
- ensure_future,
- gather,
-)
+import asyncio
from functools import reduce
from typing import Dict
@@ -174,10 +171,10 @@ class Plugin(BasePlugin):
]
for name, handler in handlers:
self.core.xmpp.del_event_handler(name, handler)
- ensure_future(self._stop())
+ asyncio.create_task(self._stop())
async def _stop(self):
- await gather(
+ await asyncio.gather(
self.core.xmpp.plugin['xep_0108'].stop(),
self.core.xmpp.plugin['xep_0107'].stop(),
self.core.xmpp.plugin['xep_0196'].stop(),
diff --git a/plugins/vcard.py b/plugins/vcard.py
index ef70dc79..b0c8e396 100644
--- a/plugins/vcard.py
+++ b/plugins/vcard.py
@@ -266,7 +266,7 @@ class Plugin(BasePlugin):
self.api.information('Invalid JID: %s' % arg, 'Error')
return
- asyncio.ensure_future(
+ asyncio.create_task(
self._get_vcard(jid)
)
@@ -290,7 +290,7 @@ class Plugin(BasePlugin):
jid = JID(arg)
except InvalidJID:
return self.api.information('Invalid JID: %s' % arg, 'Error')
- asyncio.ensure_future(
+ asyncio.create_task(
self._get_vcard(jid)
)
@@ -301,11 +301,11 @@ class Plugin(BasePlugin):
return
current = self.api.current_tab().selected_row
if isinstance(current, Resource):
- asyncio.ensure_future(
+ asyncio.create_task(
self._get_vcard(JID(current.jid).bare)
)
elif isinstance(current, Contact):
- asyncio.ensure_future(
+ asyncio.create_task(
self._get_vcard(current.bare_jid)
)
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 915f9d90..717f77ce 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -298,7 +298,7 @@ class CommandCore:
jid = self.core.tabs.current_tab.jid
if jid is None or not jid.domain:
return None
- asyncio.ensure_future(
+ asyncio.create_task(
self._list_async(jid)
)
@@ -453,7 +453,7 @@ class CommandCore:
room, nick = self._parse_join_jid(args[0] if args else '')
password = args[1] if len(args) > 1 else None
- asyncio.ensure_future(
+ asyncio.create_task(
self._add_bookmark(
room=room,
nick=nick,
@@ -478,7 +478,7 @@ class CommandCore:
autojoin = (method == 'local' or
(len(args) > 1 and args[1].lower() == 'true'))
- asyncio.ensure_future(
+ asyncio.create_task(
self._add_bookmark(room, nick, autojoin, password, method)
)
@@ -596,7 +596,7 @@ class CommandCore:
else:
jid = args[0]
- asyncio.ensure_future(
+ asyncio.create_task(
self._remove_bookmark_routine(jid)
)
@@ -983,7 +983,7 @@ class CommandCore:
return self.core.information('Invalid JID for /impromptu: %s' % args[0], 'Error')
jids.add(bare)
- asyncio.ensure_future(self.core.impromptu(jids))
+ asyncio.create_task(self.core.impromptu(jids))
self.core.information('Invited %s to a random room' % (', '.join(jids)), 'Info')
@command_args_parser.quoted(1, 1, [''])
@@ -1043,7 +1043,7 @@ class CommandCore:
if jid is None:
self.core.information('No specified JID to block', 'Error')
else:
- asyncio.ensure_future(self._block_async(jid))
+ asyncio.create_task(self._block_async(jid))
async def _block_async(self, jid: JID):
"""Block a JID, asynchronously"""
@@ -1096,7 +1096,7 @@ class CommandCore:
jid = JID(current_tab.jid.bare)
if jid is not None:
- asyncio.ensure_future(
+ asyncio.create_task(
self._unblock_async(jid)
)
else:
@@ -1185,7 +1185,7 @@ class CommandCore:
self.core.information('Invalid alternative room JID: "%s"' % args[2], 'Error')
return
- asyncio.ensure_future(do_destroy(room, reason, altroom))
+ asyncio.create_task(do_destroy(room, reason, altroom))
@command_args_parser.quoted(1, 1, [''])
def bind(self, args):
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 81ac6e8a..ec64f0a0 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -444,7 +444,7 @@ class Core:
if value not in ('pep', 'privatexml'):
return
self.bookmarks.preferred = value
- asyncio.ensure_future(
+ asyncio.create_task(
self.bookmarks.save(self.xmpp, core=self)
)
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index d4625b4b..bdb91475 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -108,7 +108,7 @@ class HandlerCore:
await self.core.check_bookmark_storage(features)
def find_identities(self, _):
- asyncio.ensure_future(
+ asyncio.create_task(
self.core.xmpp['xep_0030'].get_info_from_domain(),
)
@@ -1097,7 +1097,7 @@ class HandlerCore:
if config.getbool('enable_user_nick'):
self.core.xmpp.plugin['xep_0172'].publish_nick(
nick=self.core.own_nick, callback=dumb_callback)
- asyncio.ensure_future(self.core.xmpp.plugin['xep_0115'].update_caps())
+ asyncio.create_task(self.core.xmpp.plugin['xep_0115'].update_caps())
# Start the ping's plugin regular event
self.core.xmpp.set_keepalive_values()
diff --git a/poezio/fixes.py b/poezio/fixes.py
index 62e67f43..a8282006 100644
--- a/poezio/fixes.py
+++ b/poezio/fixes.py
@@ -24,7 +24,7 @@ def has_identity(xmpp, jid, identity, on_true=None, on_false=None):
if not res and on_false is not None:
on_false()
- asyncio.ensure_future(
+ asyncio.create_task(
xmpp.plugin['xep_0030'].get_info(jid=jid, callback=_cb)
)
diff --git a/poezio/log_loader.py b/poezio/log_loader.py
index 146bc9b4..caee714b 100644
--- a/poezio/log_loader.py
+++ b/poezio/log_loader.py
@@ -321,7 +321,7 @@ class MAMFiller:
self.tab = tab
self.logger = logger
logger.fd_busy(tab.jid)
- self.future = asyncio.ensure_future(self.fetch_routine())
+ self.future = asyncio.create_task(self.fetch_routine())
self.done = asyncio.Event()
self.limit = limit
self.result = 0
diff --git a/poezio/multiuserchat.py b/poezio/multiuserchat.py
index 366f6d78..3f6905ee 100644
--- a/poezio/multiuserchat.py
+++ b/poezio/multiuserchat.py
@@ -109,7 +109,7 @@ def join_groupchat(
xmpp.plugin['xep_0045'].rooms[jid] = {}
xmpp.plugin['xep_0045'].our_nicks[jid] = to.resource
- asyncio.ensure_future(
+ asyncio.create_task(
xmpp.plugin['xep_0030'].get_info(jid=jid, callback=on_disco)
)
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index 508465e3..c2d9e93e 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -351,7 +351,7 @@ class Tab:
if hasattr(self.input, "reset_completion"):
self.input.reset_completion()
if asyncio.iscoroutinefunction(func):
- asyncio.ensure_future(func(arg))
+ asyncio.create_task(func(arg))
else:
func(arg)
return True
@@ -979,7 +979,7 @@ class ChatTab(Tab):
def on_scroll_up(self):
if not self.query_status:
from poezio.log_loader import LogLoader
- asyncio.ensure_future(
+ asyncio.create_task(
LogLoader(logger, self, config.getbool('use_log')).scroll_requested()
)
return self.text_win.scroll_up(self.text_win.height - 1)
@@ -1036,10 +1036,10 @@ class OneToOneTab(ChatTab):
if mam_filler.result == 0:
self.handle_message(initial)
- asyncio.ensure_future(fallback_no_mam())
+ asyncio.create_task(fallback_no_mam())
elif use_log and initial:
self.handle_message(initial, display=False)
- asyncio.ensure_future(
+ asyncio.create_task(
LogLoader(logger, self, use_log).tab_open()
)
diff --git a/poezio/tabs/bookmarkstab.py b/poezio/tabs/bookmarkstab.py
index 10c7c0ce..d21b5630 100644
--- a/poezio/tabs/bookmarkstab.py
+++ b/poezio/tabs/bookmarkstab.py
@@ -96,7 +96,7 @@ class BookmarksTab(Tab):
if bm in self.bookmarks:
self.bookmarks.remove(bm)
- asyncio.ensure_future(
+ asyncio.create_task(
self.save_routine()
)
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index acc145af..8acb9773 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -154,14 +154,14 @@ class MucTab(ChatTab):
"""
The user do not want to send their config, send an iq cancel
"""
- asyncio.ensure_future(self.core.xmpp['xep_0045'].cancel_config(self.jid))
+ asyncio.create_task(self.core.xmpp['xep_0045'].cancel_config(self.jid))
self.core.close_tab()
def send_config(self, form: Form) -> None:
"""
The user sends their config to the server
"""
- asyncio.ensure_future(self.core.xmpp['xep_0045'].set_room_config(self.jid, form))
+ asyncio.create_task(self.core.xmpp['xep_0045'].set_room_config(self.jid, form))
self.core.close_tab()
def join(self) -> None:
@@ -610,7 +610,7 @@ class MucTab(ChatTab):
},
),
)
- asyncio.ensure_future(LogLoader(
+ asyncio.create_task(LogLoader(
logger, self, config.get_by_tabname('use_log', self.general_jid)
).tab_open())
@@ -1513,7 +1513,7 @@ class MucTab(ChatTab):
bookmark = self.core.bookmarks[self.jid]
if bookmark:
bookmark.autojoin = False
- asyncio.ensure_future(
+ asyncio.create_task(
self.core.bookmarks.save(self.core.xmpp)
)
self.core.close_tab(self)