diff options
author | mathieui <mathieui@mathieui.net> | 2022-02-06 17:37:13 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2022-02-06 17:37:13 +0100 |
commit | 911cf335a12e662e781f1d8adff418c81e43a22d (patch) | |
tree | 769442efd9e68de16b708495725854d44fc0e64c /poezio/tabs | |
parent | 8847f3e7de8f36de2079f9622e4673734e9d4a84 (diff) | |
download | poezio-911cf335a12e662e781f1d8adff418c81e43a22d.tar.gz poezio-911cf335a12e662e781f1d8adff418c81e43a22d.tar.bz2 poezio-911cf335a12e662e781f1d8adff418c81e43a22d.tar.xz poezio-911cf335a12e662e781f1d8adff418c81e43a22d.zip |
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.
Diffstat (limited to 'poezio/tabs')
-rw-r--r-- | poezio/tabs/conversationtab.py | 5 | ||||
-rw-r--r-- | poezio/tabs/privatetab.py | 5 |
2 files changed, 8 insertions, 2 deletions
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() |