mirror of
https://github.com/chatmail/core.git
synced 2026-04-18 22:16:30 +03:00
fix: Delete resent messages on receiver side (#5155)
If a Delta Chat message has the Message-ID already existing in the db, but a greater "Date", it's a resent message that can be deleted. Messages having the same "Date" mustn't be deleted because they can be already seen messages moved back to INBOX. Also don't delete messages having lesser "Date" to avoid deleting both messages in a multi-device setting.
This commit is contained in:
@@ -477,6 +477,16 @@ class Account:
|
||||
msg_ids = [msg.id for msg in messages]
|
||||
lib.dc_forward_msgs(self._dc_context, msg_ids, len(msg_ids), chat.id)
|
||||
|
||||
def resend_messages(self, messages: List[Message]) -> None:
|
||||
"""Resend list of messages.
|
||||
|
||||
:param messages: list of :class:`deltachat.message.Message` object.
|
||||
:returns: None
|
||||
"""
|
||||
msg_ids = [msg.id for msg in messages]
|
||||
if lib.dc_resend_msgs(self._dc_context, msg_ids, len(msg_ids)) != 1:
|
||||
raise ValueError(f"could not resend messages {msg_ids}")
|
||||
|
||||
def delete_messages(self, messages: List[Message]) -> None:
|
||||
"""delete messages (local and remote).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user