fix: Remove footer from reactions on the receiver side (#4780)

Reactions do not have footer since 6d2ac30. However, mailing lists still add the footer to the
messages, and receiver interpreted words as a reaction.
This commit is contained in:
iequidoo
2023-10-04 21:00:32 -03:00
committed by iequidoo
parent 1040bc551f
commit 0d22fc7ac1
3 changed files with 38 additions and 1 deletions

View File

@@ -67,6 +67,15 @@ fn remove_nonstandard_footer<'a>(lines: &'a [&str]) -> (&'a [&'a str], bool) {
(lines, false)
}
/// Remove footers if any.
/// This also makes all newlines "\n", but why not.
pub(crate) fn remove_footers(msg: &str) -> String {
let lines = split_lines(msg);
let lines = remove_message_footer(&lines).0;
let lines = remove_nonstandard_footer(lines).0;
lines.join("\n")
}
pub(crate) fn split_lines(buf: &str) -> Vec<&str> {
buf.split('\n').collect()
}