Skip to content
Snippets Groups Projects
Commit 6f472cc1 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

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.
parent a17a0307
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment