diff options
Diffstat (limited to 'poezio/tabs')
-rw-r--r-- | poezio/tabs/basetabs.py | 16 | ||||
-rw-r--r-- | poezio/tabs/conversationtab.py | 9 | ||||
-rw-r--r-- | poezio/tabs/muctab.py | 8 | ||||
-rw-r--r-- | poezio/tabs/privatetab.py | 6 |
4 files changed, 19 insertions, 20 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index 431acf17..c88a8a10 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -669,7 +669,9 @@ class ChatTab(Tab): if not self.execute_command(txt): if txt.startswith('//'): txt = txt[1:] - self.command_say(xhtml.convert_simple_to_full_colors(txt)) + asyncio.ensure_future( + self.command_say(xhtml.convert_simple_to_full_colors(txt)) + ) self.cancel_paused_delay() @command_args_parser.raw @@ -794,7 +796,7 @@ class ChatTab(Tab): self.last_sent_message = msg @command_args_parser.raw - def command_correct(self, line: str) -> None: + async def command_correct(self, line: str) -> None: """ /correct <fixed message> """ @@ -804,7 +806,7 @@ class ChatTab(Tab): if not self.last_sent_message: self.core.information('There is no message to correct.', 'Error') return - self.command_say(line, correct=True) + await self.command_say(line, correct=True) def completion_correct(self, the_input): if self.last_sent_message and the_input.get_argument_position() == 1: @@ -838,7 +840,7 @@ class ChatTab(Tab): self.state = 'scrolled' @command_args_parser.raw - def command_say(self, line: str, attention: bool = False, correct: bool = False): + async def command_say(self, line: str, attention: bool = False, correct: bool = False): pass def goto_build_lines(self, new_date): @@ -1110,10 +1112,10 @@ class OneToOneTab(ChatTab): self.refresh() @command_args_parser.raw - def command_attention(self, message): + async def command_attention(self, message): """/attention [message]""" if message != '': - self.command_say(message, attention=True) + await self.command_say(message, attention=True) else: msg = self.core.xmpp.make_message(self.get_dest_jid()) msg['type'] = 'chat' @@ -1121,7 +1123,7 @@ class OneToOneTab(ChatTab): msg.send() @command_args_parser.raw - def command_say(self, line: str, attention: bool = False, correct: bool = False): + async def command_say(self, line: str, attention: bool = False, correct: bool = False): pass @command_args_parser.ignored diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index 9cf68d75..76c86d70 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -172,7 +172,7 @@ class ConversationTab(OneToOneTab): @refresh_wrapper.always @command_args_parser.raw - def command_say(self, line: str, attention: bool = False, correct: bool = False): + async def command_say(self, line: str, attention: bool = False, correct: bool = False): msg: SMessage = self.core.xmpp.make_message( mto=self.get_dest_jid(), mfrom=self.core.xmpp.boundjid @@ -189,7 +189,6 @@ class ConversationTab(OneToOneTab): self.core.events.trigger('conversation_say', msg, self) if not msg['body']: return - replaced = False if correct or msg['replace']['id']: msg['replace']['id'] = self.last_sent_message['id'] # type: ignore else: @@ -209,12 +208,10 @@ class ConversationTab(OneToOneTab): if not msg['body']: return self.set_last_sent_message(msg, correct=correct) - asyncio.ensure_future( - self.core.handler.on_normal_message(msg) - ) - # Our receipts slixmpp hack msg._add_receipt = True # type: ignore msg.send() + await self.core.handler.on_normal_message(msg) + # Our receipts slixmpp hack self.cancel_paused_delay() @command_args_parser.quoted(0, 1) diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py index 654b990a..e2c27ab1 100644 --- a/poezio/tabs/muctab.py +++ b/poezio/tabs/muctab.py @@ -1682,8 +1682,10 @@ class MucTab(ChatTab): r = self.core.open_private_window(self.jid.bare, user.nick) if r and len(args) == 2: msg = args[1] - r.command_say( - xhtml.convert_simple_to_full_colors(msg) + asyncio.ensure_future( + r.command_say( + xhtml.convert_simple_to_full_colors(msg) + ) ) if not r: self.core.information("Cannot find user: %s" % nick, 'Error') @@ -1856,7 +1858,7 @@ class MucTab(ChatTab): return None @command_args_parser.raw - def command_say(self, line: str, attention: bool = False, correct: bool = False): + async def command_say(self, line: str, attention: bool = False, correct: bool = False): """ /say <message> Or normal input + enter diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index fc126b66..9ed968b7 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -202,7 +202,7 @@ class PrivateTab(OneToOneTab): @refresh_wrapper.always @command_args_parser.raw - def command_say(self, line: str, attention: bool = False, correct: bool = False) -> None: + async def command_say(self, line: str, attention: bool = False, correct: bool = False) -> None: if not self.on: return our_jid = JID(self.jid.bare) @@ -240,9 +240,7 @@ class PrivateTab(OneToOneTab): if not msg['body']: return self.set_last_sent_message(msg, correct=correct) - asyncio.ensure_future( - self.core.handler.on_groupchat_private_message(msg, sent=True) - ) + await self.core.handler.on_groupchat_private_message(msg, sent=True) # Our receipts slixmpp hack msg._add_receipt = True # type: ignore msg.send() |