Refactoring: remove store from PartInfo
This commit is contained in:
parent
4711933b41
commit
df20f1cd03
|
@ -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 {
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -286,7 +286,6 @@ func (mv *MessageViewer) SelectedMessagePart() *PartInfo {
|
|||
Index: part.index,
|
||||
Msg: part.msg.MessageInfo(),
|
||||
Part: part.part,
|
||||
Store: mv.Store(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ type PartInfo struct {
|
|||
Index []int
|
||||
Msg *models.MessageInfo
|
||||
Part *models.BodyStructure
|
||||
Store *lib.MessageStore
|
||||
}
|
||||
|
||||
type ProvidesMessage interface {
|
||||
|
|
Loading…
Reference in New Issue