aboutsummaryrefslogtreecommitdiffstats
path: root/worker
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-04-24 23:18:51 +0200
committerRobin Jarry <robin@jarry.cc>2023-04-26 00:07:48 +0200
commita72313b8a1c5d1b6df646e839e7c2a27697f4c88 (patch)
treec4f8df2f8681edaf96702025f2257004678d8b5c /worker
parent6ea0f18635a8be20b89e11af53333cc9fee5d04f (diff)
downloadaerc-a72313b8a1c5d1b6df646e839e7c2a27697f4c88.tar.gz
imap: add size field to cache struct
Add size field to the cache struct and increment cache tag. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker')
-rw-r--r--worker/imap/cache.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/worker/imap/cache.go b/worker/imap/cache.go
index cc97b922..94cebb92 100644
--- a/worker/imap/cache.go
+++ b/worker/imap/cache.go
@@ -27,6 +27,7 @@ type CachedHeader struct {
Envelope models.Envelope
InternalDate time.Time
Uid uint32
+ Size uint32
Header []byte
Created time.Time
}
@@ -35,7 +36,7 @@ var (
// cacheTag should be updated when changing the cache
// structure; this will ensure that the user's cache is cleared and
// reloaded when the underlying cache structure changes
- cacheTag = []byte("0000")
+ cacheTag = []byte("0001")
cacheTagKey = []byte("cache.tag")
)
@@ -95,6 +96,7 @@ func (w *IMAPWorker) cacheHeader(mi *models.MessageInfo) {
Envelope: *mi.Envelope,
InternalDate: mi.InternalDate,
Uid: mi.Uid,
+ Size: mi.Size,
Header: hdr.Bytes(),
Created: time.Now(),
}
@@ -147,6 +149,7 @@ func (w *IMAPWorker) getCachedHeaders(msg *types.FetchMessageHeaders) []uint32 {
Uid: ch.Uid,
RFC822Headers: hdr,
Refs: parse.MsgIDList(hdr, "references"),
+ Size: ch.Size,
}
log.Tracef("located cached header %s.%s", uv, u)
w.worker.PostMessage(&types.MessageInfo{