diff options
Diffstat (limited to 'lib/msgstore.go')
-rw-r--r-- | lib/msgstore.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go index 64b1638..2169b2e 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -67,7 +67,6 @@ func (store *MessageStore) FetchHeaders(uids []uint32, } func (store *MessageStore) FetchBodies(uids []uint32, cb func(io.Reader)) { - // TODO: this could be optimized by pre-allocating toFetch and trimming it // at the end. In practice we expect to get most messages back in one frame. var toFetch imap.SeqSet @@ -89,6 +88,21 @@ func (store *MessageStore) FetchBodies(uids []uint32, cb func(io.Reader)) { } } +func (store *MessageStore) FetchBodyPart( + uid uint32, part int, cb func(io.Reader)) { + + store.worker.PostAction(&types.FetchMessageBodyPart{ + Uid: uid, + Part: part, + }, func(resp types.WorkerMessage) { + msg, ok := resp.(*types.MessageBodyPart) + if !ok { + return + } + cb(msg.Reader) + }) +} + func (store *MessageStore) merge( to *types.MessageInfo, from *types.MessageInfo) { |