mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 14:36:29 +03:00
Implement MsgId.unlink() and use it in DeleteMsgOnImap
Currently only trashed or hidden messages are deleted by DeleteMsgOnImap, so it is safe to remove database records. It is planned to delete messages on IMAP server after user-configurable time to cleanup the server even for messages displayed in chats. For such messages, we unlink them from the Message-ID, but keep the database record to display them.
This commit is contained in:
@@ -119,6 +119,23 @@ impl MsgId {
|
||||
.ok();
|
||||
}
|
||||
|
||||
/// Removes Message-ID, IMAP server UID, folder from the database
|
||||
/// record.
|
||||
///
|
||||
/// It is used to avoid trying to remove the message from the
|
||||
/// server multiple times when there are multiple message records
|
||||
/// pointing to the same server UID.
|
||||
pub(crate) fn unlink(self, context: &Context) -> sql::Result<()> {
|
||||
sql::execute(
|
||||
context,
|
||||
&context.sql,
|
||||
"UPDATE msgs \
|
||||
SET rfc724_mid='', server_folder='', server_uid=0 \
|
||||
WHERE id=?",
|
||||
params![self],
|
||||
)
|
||||
}
|
||||
|
||||
/// Bad evil escape hatch.
|
||||
///
|
||||
/// Avoid using this, eventually types should be cleaned up enough
|
||||
|
||||
Reference in New Issue
Block a user