Pop-out messageID format into constants

This commit is contained in:
Pavel Škoda
2020-05-11 16:17:59 +02:00
committed by Pavel Škoda
parent 30425d5fcd
commit 70fca64a36
5 changed files with 21 additions and 12 deletions

View File

@ -148,10 +148,10 @@ func (im *imapMailbox) CreateMessage(flags []string, date time.Time, body imap.L
if len(referenceList) > 0 {
lastReference := referenceList[len(referenceList)-1]
// In case we are using a mail client which corrupts headers, try "References" too.
re := regexp.MustCompile(`(?U)<.*@protonmail.internalid>`)
match := re.FindString(lastReference)
if match != "" {
internalID = match[1 : len(match)-len("@protonmail.internalid>")]
re := regexp.MustCompile(pmapi.InternalReferenceFormat)
match := re.FindStringSubmatch(lastReference)
if len(match) > 0 {
internalID = match[1]
}
}