summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2019-08-25 23:00:49 +0200
committermathieui <mathieui@mathieui.net>2019-08-25 23:00:49 +0200
commit45d12b90928fb80dcdba8d4328e254827cb6cc80 (patch)
tree395e52ee3a4101932126ab96a2eea6c466695487
parenta157a21c87446cd99021e94ebda050d7de94455c (diff)
downloadpoezio-45d12b90928fb80dcdba8d4328e254827cb6cc80.tar.gz
poezio-45d12b90928fb80dcdba8d4328e254827cb6cc80.tar.bz2
poezio-45d12b90928fb80dcdba8d4328e254827cb6cc80.tar.xz
poezio-45d12b90928fb80dcdba8d4328e254827cb6cc80.zip
Fix private tabs
- receipts - receiving messages - showing our sent messages
-rw-r--r--poezio/core/handlers.py2
-rw-r--r--poezio/tabs/privatetab.py13
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()