Format message lines starting with > as quotes

This makes quotes created by user display properly in other MUAs like
Thunderbird and not start with space in MUAs that don't support format=flowed.

To distinguish user-created quotes from top-quote inserted by Delta
Chat, a newline is inserted if there is no top-quote and the first
line starts with ">".

Nested quotes are not supported, e.g. line starting with "> >" will
start with ">" on the next line if wrapped.
This commit is contained in:
link2xt
2022-06-17 23:09:25 +00:00
parent 377fa01e98
commit 525b04e69e
4 changed files with 71 additions and 29 deletions

View File

@@ -1085,10 +1085,15 @@ impl<'a> MimeFactory<'a> {
}
};
let quoted_text = self
let mut quoted_text = self
.msg
.quoted_text()
.map(|quote| format_flowed_quote(&quote) + "\r\n\r\n");
if quoted_text.is_none() && final_text.starts_with('>') {
// Insert empty line to avoid receiver treating user-sent quote as topquote inserted by
// Delta Chat.
quoted_text = Some("\r\n".to_string());
}
let flowed_text = format_flowed(final_text);
let footer = &self.selfstatus;