diff options
Diffstat (limited to 'commands/msg')
-rw-r--r-- | commands/msg/archive.go | 5 | ||||
-rw-r--r-- | commands/msg/copy.go | 5 | ||||
-rw-r--r-- | commands/msg/delete.go | 6 | ||||
-rw-r--r-- | commands/msg/move.go | 5 | ||||
-rw-r--r-- | commands/msg/pipe.go | 5 | ||||
-rw-r--r-- | commands/msg/read.go | 5 | ||||
-rw-r--r-- | commands/msg/reply.go | 5 | ||||
-rw-r--r-- | commands/msg/unsubscribe.go | 6 |
8 files changed, 32 insertions, 10 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go index 40fb48bc..fe391d28 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -41,7 +41,10 @@ func (_ Archive) Execute(aerc *widgets.Aerc, args []string) error { if acct == nil { return errors.New("No account selected") } - msg := widget.SelectedMessage() + msg, err := widget.SelectedMessage() + if err != nil { + return err + } store := widget.Store() archiveDir := acct.AccountConfig().Archive store.Next() diff --git a/commands/msg/copy.go b/commands/msg/copy.go index 4d65d249..48bccd4d 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -44,7 +44,10 @@ func (_ Copy) Execute(aerc *widgets.Aerc, args []string) error { } widget := aerc.SelectedTab().(widgets.ProvidesMessage) - msg := widget.SelectedMessage() + msg, err := widget.SelectedMessage() + if err != nil { + return err + } store := widget.Store() store.Copy([]uint32{msg.Uid}, args[optind], createParents, func( msg types.WorkerMessage) { diff --git a/commands/msg/delete.go b/commands/msg/delete.go index 104e1e1f..36b8d8cf 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -35,10 +35,10 @@ func (_ Delete) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("No account selected") } store := widget.Store() - if len(store.Uids) == 0 { - return errors.New("No message selected") + msg, err := widget.SelectedMessage() + if err != nil { + return err } - msg := widget.SelectedMessage() _, isMsgView := widget.(*widgets.MessageViewer) if isMsgView { aerc.RemoveTab(widget) diff --git a/commands/msg/move.go b/commands/msg/move.go index c98157e0..8b19a101 100644 --- a/commands/msg/move.go +++ b/commands/msg/move.go @@ -49,7 +49,10 @@ func (_ Move) Execute(aerc *widgets.Aerc, args []string) error { if acct == nil { return errors.New("No account selected") } - msg := widget.SelectedMessage() + msg, err := widget.SelectedMessage() + if err != nil { + return err + } store := widget.Store() _, isMsgView := widget.(*widgets.MessageViewer) if isMsgView { diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 9f4a0099..821f3591 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -112,7 +112,10 @@ func (_ Pipe) Execute(aerc *widgets.Aerc, args []string) error { if pipeFull { store := provider.Store() - msg := provider.SelectedMessage() + msg, err := provider.SelectedMessage() + if err != nil { + return err + } store.FetchFull([]uint32{msg.Uid}, func(reader io.Reader) { if background { doExec(reader) diff --git a/commands/msg/read.go b/commands/msg/read.go index db463f18..30c6822d 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -30,7 +30,10 @@ func (_ Read) Execute(aerc *widgets.Aerc, args []string) error { } widget := aerc.SelectedTab().(widgets.ProvidesMessage) - msg := widget.SelectedMessage() + msg, err := widget.SelectedMessage() + if err != nil { + return err + } store := widget.Store() store.Read([]uint32{msg.Uid}, args[0] == "read", func( msg types.WorkerMessage) { diff --git a/commands/msg/reply.go b/commands/msg/reply.go index 68c20899..5295ee6c 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -60,7 +60,10 @@ func (_ reply) Execute(aerc *widgets.Aerc, args []string) error { conf := acct.AccountConfig() us, _ := gomail.ParseAddress(conf.From) store := widget.Store() - msg := widget.SelectedMessage() + msg, err := widget.SelectedMessage() + if err != nil { + return err + } acct.Logger().Println("Replying to email " + msg.Envelope.MessageId) var ( diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go index d4a7e9a6..720ff43e 100644 --- a/commands/msg/unsubscribe.go +++ b/commands/msg/unsubscribe.go @@ -34,7 +34,11 @@ func (Unsubscribe) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("Usage: unsubscribe") } widget := aerc.SelectedTab().(widgets.ProvidesMessage) - headers := widget.SelectedMessage().RFC822Headers + msg, err := widget.SelectedMessage() + if err != nil { + return err + } + headers := msg.RFC822Headers if !headers.Has("list-unsubscribe") { return errors.New("No List-Unsubscribe header found") } |