add rfc 4155 about mbox files, and cross-reference in the import/export code for mbox files

This commit is contained in:
Mechiel Lukkien
2025-03-23 13:59:09 +01:00
parent a68a9d8a48
commit 88ec5c6fbe
3 changed files with 10 additions and 2 deletions

View File

@ -100,7 +100,7 @@ func (mr *MboxReader) Next() (*Message, *os.File, string, error) {
}
if len(line) > 0 {
mr.line++
// We store data with crlf, adjust any imported messages with bare newlines.
// We store data with crlf, adjust any imported messages with bare newlines. ../rfc/4155:354
if !bytes.HasSuffix(line, []byte("\r\n")) {
line = append(line[:len(line)-1], "\r\n"...)
}
@ -156,12 +156,13 @@ func (mr *MboxReader) Next() (*Message, *os.File, string, error) {
mr.header = false
}
// Next mail message starts at bare From word.
// Next mail message starts at bare From word. ../rfc/4155:71
if mr.prevempty && bytes.HasPrefix(line, from) {
mr.fromLine = strings.TrimSpace(string(line))
mr.header = true
break
}
// ../rfc/4155:119
if bytes.HasPrefix(line, []byte(">")) && bytes.HasPrefix(bytes.TrimLeft(line, ">"), []byte("From ")) {
line = line[1:]
}