summaryrefslogtreecommitdiff
path: root/poezio/tabs/privatetab.py
diff options
context:
space:
mode:
Diffstat (limited to 'poezio/tabs/privatetab.py')
-rw-r--r--poezio/tabs/privatetab.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py
index fb89d8e6..1909e3c1 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
@@ -47,7 +48,7 @@ class PrivateTab(OneToOneTab):
additional_information: Dict[str, Callable[[str], str]] = {}
def __init__(self, core, jid, nick, initial=None):
- OneToOneTab.__init__(self, core, jid)
+ OneToOneTab.__init__(self, core, jid, initial)
self.own_nick = nick
self.info_header = windows.PrivateInfoWin()
self.input = windows.MessageInput()
@@ -84,14 +85,14 @@ class PrivateTab(OneToOneTab):
return super().remote_user_color()
@property
- def general_jid(self):
+ def general_jid(self) -> JID:
return self.jid
- def get_dest_jid(self):
+ def get_dest_jid(self) -> JID:
return self.jid
@property
- def nick(self):
+ def nick(self) -> str:
return self.get_nick()
def ack_message(self, msg_id: str, msg_jid: JID):
@@ -141,7 +142,7 @@ class PrivateTab(OneToOneTab):
and not self.input.get_text().startswith('//'))
self.send_composing_chat_state(empty_after)
- def handle_message(self, message: SMessage, display: bool = True):
+ async def handle_message(self, message: SMessage, display: bool = True):
sent = message['from'].bare == self.core.xmpp.boundjid.bare
jid = message['to'] if sent else message['from']
with_nick = jid.resource
@@ -155,7 +156,7 @@ class PrivateTab(OneToOneTab):
)
tmp_dir = get_image_cache()
if not sent:
- self.core.events.trigger('private_msg', message, self)
+ await self.core.events.trigger_async('private_msg', message, self)
body = xhtml.get_body_from_message_stanza(
message, use_xhtml=use_xhtml, extract_images_to=tmp_dir)
if not body or not self:
@@ -201,9 +202,10 @@ 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
+ await self._initial_log.wait()
our_jid = JID(self.jid.bare)
our_jid.resource = self.own_nick
msg: SMessage = self.core.xmpp.make_message(
@@ -239,7 +241,7 @@ 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)
+ await self.core.handler.on_groupchat_private_message(msg, sent=True)
# Our receipts slixmpp hack
msg._add_receipt = True # type: ignore
msg.send()
@@ -358,9 +360,6 @@ class PrivateTab(OneToOneTab):
1, self.width, self.height - 2 - self.core.information_win_size -
Tab.tab_win_height(), 0)
- def get_text_window(self):
- return self.text_win
-
@refresh_wrapper.conditional
def rename_user(self, old_nick, user):
"""