Refactoring: remove store from PartInfo

This commit is contained in:
Drew DeVault 2020-03-06 10:33:44 -05:00
parent 4711933b41
commit df20f1cd03
5 changed files with 6 additions and 5 deletions

View file

@ -126,7 +126,8 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
}) })
} else if pipePart { } else if pipePart {
p := provider.SelectedMessagePart() p := provider.SelectedMessagePart()
p.Store.FetchBodyPart(p.Msg.Uid, p.Msg.BodyStructure, p.Index, func(reader io.Reader) { store := provider.Store()
store.FetchBodyPart(p.Msg.Uid, p.Msg.BodyStructure, p.Index, func(reader io.Reader) {
if background { if background {
doExec(reader) doExec(reader)
} else { } else {

View file

@ -33,7 +33,8 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error {
mv := aerc.SelectedTab().(*widgets.MessageViewer) mv := aerc.SelectedTab().(*widgets.MessageViewer)
p := mv.SelectedMessagePart() p := mv.SelectedMessagePart()
p.Store.FetchBodyPart(p.Msg.Uid, p.Msg.BodyStructure, p.Index, func(reader io.Reader) { store := mv.Store()
store.FetchBodyPart(p.Msg.Uid, p.Msg.BodyStructure, p.Index, func(reader io.Reader) {
tmpFile, err := ioutil.TempFile(os.TempDir(), "aerc-") tmpFile, err := ioutil.TempFile(os.TempDir(), "aerc-")
if err != nil { if err != nil {
aerc.PushError(" " + err.Error()) aerc.PushError(" " + err.Error())

View file

@ -108,7 +108,8 @@ func (Save) Execute(aerc *widgets.Aerc, args []string) error {
} }
ch := make(chan error, 1) ch := make(chan error, 1)
pi.Store.FetchBodyPart( store := mv.Store()
store.FetchBodyPart(
pi.Msg.Uid, pi.Msg.BodyStructure, pi.Index, func(reader io.Reader) { pi.Msg.Uid, pi.Msg.BodyStructure, pi.Index, func(reader io.Reader) {
f, err := os.Create(path) f, err := os.Create(path)
if err != nil { if err != nil {

View file

@ -286,7 +286,6 @@ func (mv *MessageViewer) SelectedMessagePart() *PartInfo {
Index: part.index, Index: part.index,
Msg: part.msg.MessageInfo(), Msg: part.msg.MessageInfo(),
Part: part.part, Part: part.part,
Store: mv.Store(),
} }
} }

View file

@ -10,7 +10,6 @@ type PartInfo struct {
Index []int Index []int
Msg *models.MessageInfo Msg *models.MessageInfo
Part *models.BodyStructure Part *models.BodyStructure
Store *lib.MessageStore
} }
type ProvidesMessage interface { type ProvidesMessage interface {