From 45d12b90928fb80dcdba8d4328e254827cb6cc80 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 25 Aug 2019 23:00:49 +0200 Subject: Fix private tabs - receipts - receiving messages - showing our sent messages --- poezio/core/handlers.py | 2 +- poezio/tabs/privatetab.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index c17f3761..7edf060b 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -801,7 +801,7 @@ class HandlerCore: jid=message['from'], typ=1) if sent: - tab.last_sent_message = msg + tab.last_sent_message = message else: tab.last_remote_message = datetime.now() diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index c1bc95ad..6229cd1c 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -86,9 +86,9 @@ class PrivateTab(OneToOneTab): return self.get_nick() def ack_message(self, msg_id: str, msg_jid: JID): - # special case when talking to oneself - if msg_jid == self.core.xmpp.boundjid: - msg_jid = self.jid.full + if JID(msg_jid).bare == self.core.xmpp.boundjid.bare: + msg_jid = JID(self.jid.bare) + msg_jid.resource = self.own_nick super().ack_message(msg_id, msg_jid) @staticmethod @@ -149,10 +149,11 @@ class PrivateTab(OneToOneTab): def command_say(self, line, attention=False, correct=False): if not self.on: return - echo_message = self.jid.resource != self.own_nick + our_jid = JID(self.jid.bare) + our_jid.resource = self.own_nick msg = self.core.xmpp.make_message( mto=self.jid.full, - mfrom=self.core.xmpp.boundjid + mfrom=our_jid, ) msg['type'] = 'chat' msg['body'] = line @@ -182,7 +183,7 @@ class PrivateTab(OneToOneTab): if not msg['body']: return self.last_sent_message = msg - self.core.handler.on_normal_message(msg) + self.core.handler.on_groupchat_private_message(msg, sent=True) msg._add_receipt = True msg.send() self.cancel_paused_delay() -- cgit v1.2.3