mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
make sure we send out <> around message-id's in references and in-reply-to
This commit is contained in:
@@ -152,7 +152,10 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
let in_reply_to: String = row.get(0)?;
|
let in_reply_to: String = row.get(0)?;
|
||||||
let references: String = row.get(1)?;
|
let references: String = row.get(1)?;
|
||||||
|
|
||||||
Ok((in_reply_to, references))
|
Ok((
|
||||||
|
render_rfc724_mid_list(&in_reply_to),
|
||||||
|
render_rfc724_mid_list(&references),
|
||||||
|
))
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1045,12 +1048,21 @@ fn render_rfc724_mid(rfc724_mid: &str) -> String {
|
|||||||
let rfc724_mid = rfc724_mid.trim().to_string();
|
let rfc724_mid = rfc724_mid.trim().to_string();
|
||||||
|
|
||||||
if rfc724_mid.chars().nth(0).unwrap_or_default() == '<' {
|
if rfc724_mid.chars().nth(0).unwrap_or_default() == '<' {
|
||||||
rfc724_mid.to_string()
|
rfc724_mid
|
||||||
} else {
|
} else {
|
||||||
format!("<{}>", rfc724_mid).to_string()
|
format!("<{}>", rfc724_mid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_rfc724_mid_list(mid_list: &str) -> String {
|
||||||
|
mid_list
|
||||||
|
.trim()
|
||||||
|
.split_ascii_whitespace()
|
||||||
|
.map(render_rfc724_mid)
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
.join(" ")
|
||||||
|
}
|
||||||
|
|
||||||
/* ******************************************************************************
|
/* ******************************************************************************
|
||||||
* Encode/decode header words, RFC 2047
|
* Encode/decode header words, RFC 2047
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@@ -1107,4 +1119,14 @@ mod tests {
|
|||||||
"<kqjwle123@qlwe>".to_string()
|
"<kqjwle123@qlwe>".to_string()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_render_rc724_mid_list() {
|
||||||
|
assert_eq!(render_rfc724_mid_list("123@q "), "<123@q>".to_string());
|
||||||
|
assert_eq!(render_rfc724_mid_list(" 123@q "), "<123@q>".to_string());
|
||||||
|
assert_eq!(
|
||||||
|
render_rfc724_mid_list("123@q 456@d "),
|
||||||
|
"<123@q> <456@d>".to_string()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user