diff --git a/src/simplify.rs b/src/simplify.rs index ddf580b1c..de0a19b05 100644 --- a/src/simplify.rs +++ b/src/simplify.rs @@ -44,7 +44,11 @@ pub fn simplify(mut input: String, is_chat_message: bool) -> (String, bool) { let original_lines = &lines; let lines = remove_message_footer(lines); - let (lines, mut has_nonstandard_footer) = remove_nonstandard_footer(lines); + let (lines, mut has_nonstandard_footer) = if !is_chat_message { + remove_nonstandard_footer(lines) + } else { + (lines, false) + }; let (lines, mut has_bottom_quote) = if !is_chat_message { remove_bottom_quote(lines) } else { @@ -223,6 +227,14 @@ mod tests { assert!(!is_forwarded); } + #[test] + fn test_chat_message() { + let input = "Hi! How are you?\n\n---\n\nI am good.\n-- \nSent with my Delta Chat Messenger: https://delta.chat".to_string(); + let (plain, is_forwarded) = simplify(input, true); + assert_eq!(plain, "Hi! How are you?\n\n---\n\nI am good."); + assert!(!is_forwarded); + } + #[test] fn test_simplify_trim() { let input = "line1\n\r\r\rline2".to_string();