Delete BCC-self messages after "delete_server_after" time

This commit is contained in:
Alexander Krotov
2020-02-25 02:43:28 +03:00
parent b2f1d9f376
commit 6d216af507
2 changed files with 64 additions and 8 deletions

View File

@@ -1411,6 +1411,28 @@ pub(crate) fn rfc724_mid_exists(
.map_err(Into::into)
}
/// Returns all MsgIds corresponding to Message-ID
pub(crate) fn get_all_by_rfc724_mid(
context: &Context,
rfc724_mid: &str,
) -> Result<Vec<MsgId>, Error> {
ensure!(!rfc724_mid.is_empty(), "empty rfc724_mid");
let msg_ids = context.sql.query_map(
"SELECT id FROM msgs WHERE rfc724_mid=?",
params![rfc724_mid],
|row| row.get::<_, MsgId>("id"),
|ids| {
let mut ret: Vec<MsgId> = Vec::new();
for id in ids {
ret.push(id?);
}
Ok(ret)
},
)?;
Ok(msg_ids)
}
pub fn update_server_uid(
context: &Context,
rfc724_mid: &str,