/correct: send new-style LMC

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 747deb41
......@@ -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()
......
......@@ -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):
"""
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment