handle message correction correctly even if we don't print the message instantly in a chat window. Fixes #8220

This commit is contained in:
Yann Leboulanger 2016-02-29 21:29:20 +01:00
parent 0530308a99
commit 766ae0353e
3 changed files with 8 additions and 5 deletions

View File

@ -881,7 +881,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
if not count_as_new:
return
if kind in ('incoming', 'outgoing'):
if kind in ('incoming', 'incoming_queue', 'outgoing'):
self.last_received_txt[name] = text
if correct_id:
self.last_received_id[name] = correct_id[0]
@ -3022,7 +3022,8 @@ class ChatControl(ChatControlBase):
kind = 'out'
self.print_conversation(event.message, kind, tim=event.time,
encrypted=event.encrypted, subject=event.subject,
xhtml=event.xhtml, displaymarking=event.displaymarking)
xhtml=event.xhtml, displaymarking=event.displaymarking,
correct_id=event.correct_id)
if isinstance(event.msg_log_id, int):
message_ids.append(event.msg_log_id)

View File

@ -65,8 +65,8 @@ class Event:
class ChatEvent(Event):
type_ = 'chat'
def __init__ (self, message, subject, kind, time, encrypted, resource,
msg_log_id=None, xhtml=None, session=None, form_node=None, displaymarking=None,
sent_forwarded=False, time_=None, show_in_roster=False,
msg_log_id, correct_id=None, xhtml=None, session=None, form_node=None,
displaymarking=None, sent_forwarded=False, time_=None, show_in_roster=False,
show_in_systray=True):
Event.__init__(self, time_, show_in_roster=show_in_roster,
show_in_systray=show_in_systray)
@ -77,6 +77,7 @@ class ChatEvent(Event):
self.encrypted = encrypted
self.resource = resource
self.msg_log_id = msg_log_id
self.correct_id = correct_id
self.xhtml = xhtml
self.session = session
self.form_node = form_node

View File

@ -255,7 +255,8 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
if (not self.control and obj.mtype != 'normal') or \
(obj.mtype == 'normal' and not obj.popup):
event = event_t(obj.msgtxt, obj.subject, obj.mtype, obj.timestamp,
obj.encrypted, obj.resource, obj.msg_log_id, xhtml=obj.xhtml,
obj.encrypted, obj.resource, obj.msg_log_id,
correct_id=(obj.id_, obj.correct_id), xhtml=obj.xhtml,
session=self, form_node=obj.form_node,
displaymarking=obj.displaymarking,
sent_forwarded=obj.forwarded and obj.sent,