From 2d1bf7b1dd2480a9884cde01240d05a7396b3270 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 27 Feb 2021 11:09:38 +0100 Subject: misc: wrap some calls in ensure_future to prepare for slix API change Some things need to be rewritten in a cleaner way, and other need to be directly deleted, but that will need to wait for the slix api change merge. --- poezio/core/core.py | 4 +++- poezio/fixes.py | 5 ++++- poezio/multiuserchat.py | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'poezio') diff --git a/poezio/core/core.py b/poezio/core/core.py index 08ad8799..f8be2593 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -621,7 +621,9 @@ class Core: else: self.do_command(''.join(char_list), True) if self.status.show not in ('xa', 'away'): - self.xmpp.plugin['xep_0319'].idle() + asyncio.ensure_future( + self.xmpp.plugin['xep_0319'].idle() + ) self.doupdate() def save_config(self): diff --git a/poezio/fixes.py b/poezio/fixes.py index 8e6c7921..62e67f43 100644 --- a/poezio/fixes.py +++ b/poezio/fixes.py @@ -5,6 +5,7 @@ upstream. TODO: Check that they are fixed and remove those hacks """ +import asyncio from typing import Callable, Any from slixmpp import Message, Iq, ClientXMPP from slixmpp.xmlstream import ET @@ -23,7 +24,9 @@ def has_identity(xmpp, jid, identity, on_true=None, on_false=None): if not res and on_false is not None: on_false() - xmpp.plugin['xep_0030'].get_info(jid=jid, callback=_cb) + asyncio.ensure_future( + xmpp.plugin['xep_0030'].get_info(jid=jid, callback=_cb) + ) def _filter_add_receipt_request(self, stanza): diff --git a/poezio/multiuserchat.py b/poezio/multiuserchat.py index 778e9f3f..a70fb4d0 100644 --- a/poezio/multiuserchat.py +++ b/poezio/multiuserchat.py @@ -12,6 +12,7 @@ slix plugin from __future__ import annotations +import asyncio from xml.etree import ElementTree as ET from typing import ( Optional, @@ -118,7 +119,9 @@ def join_groupchat( xmpp.plugin['xep_0045'].rooms[jid] = {} xmpp.plugin['xep_0045'].our_nicks[jid] = to.resource - xmpp.plugin['xep_0030'].get_info(jid=jid, callback=on_disco) + asyncio.ensure_future( + xmpp.plugin['xep_0030'].get_info(jid=jid, callback=on_disco) + ) def leave_groupchat( -- cgit v1.2.3