Put message into trash chat and delete message text. It means the message is deleted locally, but not on the server. We keep some infos to 1. not download the same message again 2. be able to delete the message on the server if we want to `on_server`: Delete the message on the server also if it is seen on IMAP later, but only if all parts of the message are trashed with this flag. `true` if the
(self, context: &Context, on_server: bool)
| 122 | /// deletes the message. As for trashing a partially downloaded message when replacing it with |
| 123 | /// a fully downloaded one, see `receive_imf::add_parts()`. |
| 124 | pub(crate) async fn trash(self, context: &Context, on_server: bool) -> Result<()> { |
| 125 | context |
| 126 | .sql |
| 127 | .execute( |
| 128 | // If you change which information is preserved here, also change |
| 129 | // `ChatId::delete_ex()`, `delete_expired_messages()` and which information |
| 130 | // `receive_imf::add_parts()` still adds to the db if chat_id is TRASH. |
| 131 | " |
| 132 | INSERT OR REPLACE INTO msgs (id, rfc724_mid, pre_rfc724_mid, timestamp, chat_id, deleted) |
| 133 | SELECT ?1, rfc724_mid, pre_rfc724_mid, timestamp, ?, ? FROM msgs WHERE id=?1 |
| 134 | ", |
| 135 | (self, DC_CHAT_ID_TRASH, on_server), |
| 136 | ) |
| 137 | .await?; |
| 138 | |
| 139 | Ok(()) |
| 140 | } |
| 141 | |
| 142 | /// Returns whether the message state is updated to `OutDelivered`. |
| 143 | pub(crate) async fn set_delivered(self, context: &Context) -> Result<bool> { |