aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap/imap.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-11-07 10:15:48 -0600
committerRobin Jarry <robin@jarry.cc>2022-11-09 21:26:34 +0100
commitca903d4228265272a0f6a780f5ed2280772eceec (patch)
tree6c50f6c5c0171ca80e655d47446272cddbffd9ee /worker/imap/imap.go
parente0d279d6128a22db56326557883ad790544bc4f7 (diff)
downloadaerc-ca903d4228265272a0f6a780f5ed2280772eceec.tar.gz
envelope: add InReplyTo field
A standard IMAP envelope response includes the In-Reply-To header field. Add this field to the aerc model of Envelope. Update envelope parser to set this value. Update imap worker to set this value. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/imap/imap.go')
-rw-r--r--worker/imap/imap.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/worker/imap/imap.go b/worker/imap/imap.go
index 93b8a945..6e1341b2 100644
--- a/worker/imap/imap.go
+++ b/worker/imap/imap.go
@@ -1,6 +1,8 @@
package imap
import (
+ "strings"
+
"github.com/emersion/go-imap"
"git.sr.ht/~rjarry/aerc/models"
@@ -50,11 +52,8 @@ func translateEnvelope(e *imap.Envelope) *models.Envelope {
// we strip the msgid of "<>" in order to be more compatible with go-message
// which wants to handle msgids without the markers
- // note this is a very naive way of doing it but probably good enough
- msgID := e.MessageId
- if len(msgID) > 1 && msgID[0] == '<' && msgID[len(msgID)-1] == '>' {
- msgID = msgID[1 : len(msgID)-1]
- }
+ msgID := strings.TrimSuffix(strings.TrimPrefix(e.MessageId, "<"), ">")
+ inReplyTo := strings.TrimSuffix(strings.TrimPrefix(e.InReplyTo, "<"), ">")
return &models.Envelope{
Date: e.Date,
@@ -65,6 +64,7 @@ func translateEnvelope(e *imap.Envelope) *models.Envelope {
Cc: translateAddresses(e.Cc),
Bcc: translateAddresses(e.Bcc),
MessageId: msgID,
+ InReplyTo: inReplyTo,
}
}