fix: do not fail to receive post-message with status updates for deleted webxdc

receive_imf should not fail in this case,
but trash the post-message and updates.

The problem with previously used message::rfc724_mid_exists check
was that rfc724_mid_exists may return a trashed message.
This commit is contained in:
link2xt
2026-05-22 01:18:45 +02:00
committed by l
parent 98123afb62
commit 24848c0265
3 changed files with 70 additions and 11 deletions

View File

@@ -602,6 +602,31 @@ impl Message {
Ok(msg)
}
/// Loads the message with given Message-ID from the database.
///
/// Cannot return a trashed message.
pub async fn load_by_rfc724_mid_optional(
context: &Context,
rfc724_mid: &str,
) -> Result<Option<Message>> {
if let Some(msg_id) = context
.sql
.query_row_optional(
"SELECT id FROM msgs WHERE rfc724_mid=? AND chat_id != ?",
(rfc724_mid, DC_CHAT_ID_TRASH),
|row| {
let msg_id: MsgId = row.get(0)?;
Ok(msg_id)
},
)
.await?
{
Self::load_from_db_optional(context, msg_id).await
} else {
Ok(None)
}
}
/// Returns additional text which is appended to the message's text field
/// when it is loaded from the database.
/// Currently this is used to add infomation to pre-messages of what the download will be and how large it is