diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-03-31 12:14:37 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-31 12:14:37 -0400 |
commit | 27b25174e2f0249a6a1d4ba45b70f8504b63ffb1 (patch) | |
tree | b8626c746e07d9a38f95a5a817a7094c9275bfd1 /lib | |
parent | 143289bbd0736d72553a3c2a080aa3d125366b38 (diff) |
Make the message viewer real, part one
Diffstat (limited to 'lib')
-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) { |