Set message as read before removing an event

When we receive carbons of a conversation, we remove the events once
we receive a carbon from ourself, because that means we anwered from
another device.

This sets these removed messages also as read in the unread_message
table, so they dont popup on restart.
This commit is contained in:
Philipp Hörist 2017-09-29 12:41:26 +02:00
parent a17a030719
commit 6f472cc120

View file

@ -247,6 +247,12 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
# Its a Carbon Copied Message we sent
obj.show_in_roster = False
obj.show_in_systray = False
unread_events = app.events.get_events(
self.conn.name, fjid, types=['chat'])
read_ids = []
for msg in unread_events:
read_ids.append(msg.msg_log_id)
app.logger.set_read_messages(read_ids)
app.events.remove_events(self.conn.name, fjid, types=['chat'])
do_event = False
else: