aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/models.go4
-rw-r--r--worker/imap/cache.go4
-rw-r--r--worker/imap/fetch.go4
-rw-r--r--worker/lib/parse.go5
4 files changed, 17 insertions, 0 deletions
diff --git a/models/models.go b/models/models.go
index d730229c..fb628f63 100644
--- a/models/models.go
+++ b/models/models.go
@@ -71,6 +71,7 @@ type MessageInfo struct {
Labels []string
InternalDate time.Time
RFC822Headers *mail.Header
+ Refs []string
Size uint32
Uid uint32
Error error
@@ -110,6 +111,9 @@ func (mi *MessageInfo) References() ([]string, error) {
if mi == nil {
return []string{}, errors.New("msg is nil")
}
+ if mi.Refs != nil {
+ return mi.Refs, nil
+ }
if mi.RFC822Headers == nil {
return []string{}, errors.New("header is nil")
}
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,