From 911cf335a12e662e781f1d8adff418c81e43a22d Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 6 Feb 2022 17:37:13 +0100 Subject: internal: make most core.handlers async add some typing annotations on inputs as well, most are not necessary right now but the end goal is to make poezio internals much more async-friendly than it currently is. --- poezio/tabs/conversationtab.py | 5 ++++- poezio/tabs/privatetab.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'poezio/tabs') diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index 9ddb6fc1..b95dff98 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -11,6 +11,7 @@ There are two different instances of a ConversationTab: the time. """ +import asyncio import curses import logging from datetime import datetime @@ -209,7 +210,9 @@ class ConversationTab(OneToOneTab): if not msg['body']: return self.set_last_sent_message(msg, correct=correct) - self.core.handler.on_normal_message(msg) + asyncio.ensure_future( + self.core.handler.on_normal_message(msg) + ) # Our receipts slixmpp hack msg._add_receipt = True # type: ignore msg.send() diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index fb89d8e6..bb9c6538 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -10,6 +10,7 @@ both participant’s nicks. It also has slightly different features than the ConversationTab (such as tab-completion on nicks from the room). """ +import asyncio import curses import logging from datetime import datetime @@ -239,7 +240,9 @@ class PrivateTab(OneToOneTab): if not msg['body']: return self.set_last_sent_message(msg, correct=correct) - self.core.handler.on_groupchat_private_message(msg, sent=True) + asyncio.ensure_future( + self.core.handler.on_groupchat_private_message(msg, sent=True) + ) # Our receipts slixmpp hack msg._add_receipt = True # type: ignore msg.send() -- cgit v1.2.3