diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-11-07 10:15:49 -0600 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-11-09 21:26:45 +0100 |
commit | 31d2f5be3cec88d82924816c3482253557999e63 (patch) | |
tree | 404de40599ad4ad8914a89f06b6e09edca9c5869 /worker | |
parent | ca903d4228265272a0f6a780f5ed2280772eceec (diff) | |
download | aerc-31d2f5be3cec88d82924816c3482253557999e63.tar.gz |
message-info: add explicit References field
Add an explicit References field to message info. This is useful for
storing information needed for threading without storing all of the
header values, keeping system RAM usage lower.
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')
-rw-r--r-- | worker/imap/cache.go | 4 | ||||
-rw-r--r-- | worker/imap/fetch.go | 4 | ||||
-rw-r--r-- | worker/lib/parse.go | 5 |
3 files changed, 13 insertions, 0 deletions
diff --git a/worker/imap/cache.go b/worker/imap/cache.go index 17a622d6..c32131d3 100644 --- a/worker/imap/cache.go +++ b/worker/imap/cache.go @@ -118,6 +118,10 @@ func (w *IMAPWorker) getCachedHeaders(msg *types.FetchMessageHeaders) []uint32 { Uid: ch.Uid, RFC822Headers: hdr, } + refs, err := hdr.MsgIDList("references") + if err != nil { + mi.Refs = refs + } logging.Debugf("located cached header %s.%s", uv, u) w.worker.PostMessage(&types.MessageInfo{ Message: types.RespondTo(msg), diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go index 3b9c7862..f3aad36e 100644 --- a/worker/imap/fetch.go +++ b/worker/imap/fetch.go @@ -62,6 +62,10 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders( RFC822Headers: header, Uid: _msg.Uid, } + refs, err := header.MsgIDList("references") + if err != nil { + info.Refs = refs + } imapw.worker.PostMessage(&types.MessageInfo{ Message: types.RespondTo(msg), Info: info, diff --git a/worker/lib/parse.go b/worker/lib/parse.go index 6b33d246..7e1f36f2 100644 --- a/worker/lib/parse.go +++ b/worker/lib/parse.go @@ -348,11 +348,16 @@ func MessageHeaders(raw RawMessage) (*models.MessageInfo, error) { if err != nil { return nil, err } + refs, err := h.MsgIDList("references") + if err != nil { + return nil, err + } return &models.MessageInfo{ Envelope: env, Flags: flags, Labels: labels, InternalDate: recDate, + Refs: refs, Size: 0, Uid: raw.UID(), Error: parseErr, |