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 {
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 {
doExec(reader)
} else {

View File

@ -33,7 +33,8 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error {
mv := aerc.SelectedTab().(*widgets.MessageViewer)
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-")
if err != nil {
aerc.PushError(" " + err.Error())

View File

@ -108,7 +108,8 @@ func (Save) Execute(aerc *widgets.Aerc, args []string) error {
}
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) {
f, err := os.Create(path)
if err != nil {

View File

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

View File

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