mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
check in heuristically_parse_ndn() that rfc724_mid_exists() so that we do not ignore emails because we erreneously thought that it was an ndn
This commit is contained in:
@@ -406,7 +406,6 @@ async fn add_parts(
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
if chat_id.is_unset() {
|
if chat_id.is_unset() {
|
||||||
// check if the message belongs to an NDN
|
|
||||||
if mime_parser.failure_report.is_some() {
|
if mime_parser.failure_report.is_some() {
|
||||||
*chat_id = ChatId::new(DC_CHAT_ID_TRASH);
|
*chat_id = ChatId::new(DC_CHAT_ID_TRASH);
|
||||||
info!(
|
info!(
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ impl MimeMessage {
|
|||||||
failure_report: None,
|
failure_report: None,
|
||||||
};
|
};
|
||||||
parser.parse_mime_recursive(context, &mail).await?;
|
parser.parse_mime_recursive(context, &mail).await?;
|
||||||
parser.heuristically_parse_ndn().await;
|
parser.heuristically_parse_ndn(context).await;
|
||||||
parser.parse_headers(context)?;
|
parser.parse_headers(context)?;
|
||||||
|
|
||||||
Ok(parser)
|
Ok(parser)
|
||||||
@@ -900,7 +900,7 @@ impl MimeMessage {
|
|||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn heuristically_parse_ndn(&mut self) -> Option<()> {
|
async fn heuristically_parse_ndn(&mut self, context: &Context) -> Option<()> {
|
||||||
if self
|
if self
|
||||||
.get(HeaderDef::Subject)?
|
.get(HeaderDef::Subject)?
|
||||||
.to_ascii_lowercase()
|
.to_ascii_lowercase()
|
||||||
@@ -922,15 +922,19 @@ impl MimeMessage {
|
|||||||
}
|
}
|
||||||
if let Some(c) = RE.captures(line) {
|
if let Some(c) = RE.captures(line) {
|
||||||
if let Ok(original_message_id) = parse_message_id(&c[1]) {
|
if let Ok(original_message_id) = parse_message_id(&c[1]) {
|
||||||
self.failure_report = Some(FailureReport {
|
if let Ok(Some(_)) =
|
||||||
rfc724_mid: original_message_id,
|
message::rfc724_mid_exists(context, &original_message_id).await
|
||||||
failed_recipient: None,
|
{
|
||||||
})
|
self.failure_report = Some(FailureReport {
|
||||||
|
rfc724_mid: original_message_id,
|
||||||
|
failed_recipient: None,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None // Always return None, we just return anything so that we can use the '?' operator.
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle reports
|
/// Handle reports
|
||||||
@@ -956,7 +960,7 @@ impl MimeMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(original_message_id) = &self.failure_report {
|
if let Some(failure_report) = &self.failure_report {
|
||||||
let error = parts.iter().find(|p| p.typ == Viewtype::Text).map(|p| {
|
let error = parts.iter().find(|p| p.typ == Viewtype::Text).map(|p| {
|
||||||
let msg = &p.msg;
|
let msg = &p.msg;
|
||||||
match msg.find("\n--- ") {
|
match msg.find("\n--- ") {
|
||||||
@@ -965,7 +969,7 @@ impl MimeMessage {
|
|||||||
}
|
}
|
||||||
.trim()
|
.trim()
|
||||||
});
|
});
|
||||||
message::ndn_from_ext(context, original_message_id, error).await
|
message::ndn_from_ext(context, failure_report, error).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user