summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/core/handlers.py4
-rw-r--r--poezio/tabs/basetabs.py9
-rw-r--r--poezio/tabs/conversationtab.py2
-rw-r--r--poezio/tabs/muctab.py2
-rw-r--r--poezio/tabs/privatetab.py2
5 files changed, 14 insertions, 5 deletions
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index 9089cd0c..94b4da5c 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -770,7 +770,7 @@ class HandlerCore:
self.core.events.trigger('highlight', message, tab)
if message['from'].resource == tab.own_nick:
- tab.last_sent_message = message
+ tab.set_last_sent_message(message, correct=replaced)
if tab is self.core.tabs.current_tab:
tab.text_win.refresh()
@@ -862,7 +862,7 @@ class HandlerCore:
jid=message['from'],
typ=1)
if sent:
- tab.last_sent_message = message
+ tab.set_last_sent_message(message, correct=replaced)
else:
tab.last_remote_message = datetime.now()
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index c5d074bd..706172ed 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -748,6 +748,15 @@ class ChatTab(Tab):
self.core.remove_timed_event(self.timed_event_not_paused)
self.timed_event_not_paused = None
+ def set_last_sent_message(self, msg, correct=False):
+ """Ensure last_sent_message is set with the correct attributes"""
+ if correct:
+ # XXX: Is the copy needed. Is the object passed here reused
+ # afterwards? Who knows.
+ msg = copy.copy(msg)
+ msg['id'] = self.last_sent_message['id']
+ self.last_sent_message = msg
+
@command_args_parser.raw
def command_correct(self, line):
"""
diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py
index 39411872..410c5eda 100644
--- a/poezio/tabs/conversationtab.py
+++ b/poezio/tabs/conversationtab.py
@@ -139,7 +139,7 @@ class ConversationTab(OneToOneTab):
self.core.events.trigger('conversation_say_after', msg, self)
if not msg['body']:
return
- self.last_sent_message = msg
+ self.set_last_sent_message(msg, correct=correct)
self.core.handler.on_normal_message(msg)
msg._add_receipt = True
msg.send()
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index 73aa1457..540911cb 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -1681,7 +1681,7 @@ class MucTab(ChatTab):
self.text_win.refresh()
self.input.refresh()
return
- self.last_sent_message = msg
+ self.set_last_sent_message(msg, correct=correct)
msg.send()
self.chat_state = needed
diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py
index 8d2c1b11..ee4cd84c 100644
--- a/poezio/tabs/privatetab.py
+++ b/poezio/tabs/privatetab.py
@@ -177,7 +177,7 @@ class PrivateTab(OneToOneTab):
self.core.events.trigger('private_say_after', msg, self)
if not msg['body']:
return
- self.last_sent_message = msg
+ self.set_last_sent_message(msg, correct=correct)
self.core.handler.on_groupchat_private_message(msg, sent=True)
msg._add_receipt = True
msg.send()