diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-07-08 18:32:31 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-07-08 18:32:31 -0400 |
commit | 133085b436f56bdd48fb1aba1184811b3a278d3c (patch) | |
tree | 5f010744ca4bd9e0cf97c6cdad93bf5e7feb8020 /lib | |
parent | 6797f9347603aff0831bf56566fbf164cbdda179 (diff) | |
download | aerc-133085b436f56bdd48fb1aba1184811b3a278d3c.tar.gz |
Fix re-opening of expired pipe tabs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/msgstore.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go index 595908d6..038c3cac 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -92,7 +92,18 @@ func (store *MessageStore) FetchFull(uids []uint32, cb func(io.Reader)) { } } if len(toFetch) > 0 { - store.worker.PostAction(&types.FetchFullMessages{Uids: toFetch}, nil) + store.worker.PostAction(&types.FetchFullMessages{ + Uids: toFetch, + }, func(msg types.WorkerMessage) { + switch msg.(type) { + case *types.Error: + for _, uid := range toFetch { + if _, ok := store.bodyCallbacks[uid]; ok { + delete(store.bodyCallbacks, uid) + } + } + } + }) } } @@ -169,6 +180,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) { for _, cb := range cbs { cb(msg.Content.Reader) } + delete(store.bodyCallbacks, msg.Content.Uid) } } case *types.MessagesDeleted: |