mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
refactor: flatten GENERATED_PREFIX check in receive_imf_inner
This commit is contained in:
@@ -113,21 +113,20 @@ pub(crate) async fn receive_imf_inner(
|
|||||||
{
|
{
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!(context, "receive_imf: can't parse MIME: {err:#}.");
|
warn!(context, "receive_imf: can't parse MIME: {err:#}.");
|
||||||
let msg_ids;
|
if rfc724_mid.starts_with(GENERATED_PREFIX) {
|
||||||
if !rfc724_mid.starts_with(GENERATED_PREFIX) {
|
|
||||||
let row_id = context
|
|
||||||
.sql
|
|
||||||
.execute(
|
|
||||||
"INSERT INTO msgs(rfc724_mid, chat_id) VALUES (?,?)",
|
|
||||||
(rfc724_mid, DC_CHAT_ID_TRASH),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
msg_ids = vec![MsgId::new(u32::try_from(row_id)?)];
|
|
||||||
} else {
|
|
||||||
return Ok(None);
|
|
||||||
// We don't have an rfc724_mid, there's no point in adding a trash entry
|
// We don't have an rfc724_mid, there's no point in adding a trash entry
|
||||||
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let row_id = context
|
||||||
|
.sql
|
||||||
|
.execute(
|
||||||
|
"INSERT INTO msgs(rfc724_mid, chat_id) VALUES (?,?)",
|
||||||
|
(rfc724_mid, DC_CHAT_ID_TRASH),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
let msg_ids = vec![MsgId::new(u32::try_from(row_id)?)];
|
||||||
|
|
||||||
return Ok(Some(ReceivedMsg {
|
return Ok(Some(ReceivedMsg {
|
||||||
chat_id: DC_CHAT_ID_TRASH,
|
chat_id: DC_CHAT_ID_TRASH,
|
||||||
state: MessageState::Undefined,
|
state: MessageState::Undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user