summary refs log tree commit diff stats
path: root/commands/msg
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2019-12-18 06:34:05 +0100
committerDrew DeVault <sir@cmpwn.com>2019-12-21 09:27:52 -0500
commit113de3596120b78aa78acb9e3335fd40029651da (patch)
tree6a5b17bb1f6b4b150b6268c505d3102e8db8f9c9 /commands/msg
parent7b359be0cd3500e3c7382f110d5cb4ddaf1ce437 (diff)
downloadaerc-113de3596120b78aa78acb9e3335fd40029651da.tar.gz
move: adapt to ProvidesMessages
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/move.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/commands/msg/move.go b/commands/msg/move.go
index d7e1ea9..37402ef 100644
--- a/commands/msg/move.go
+++ b/commands/msg/move.go
@@ -45,27 +45,27 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
 		}
 	}
 
-	widget := aerc.SelectedTab().(widgets.ProvidesMessage)
-	acct := widget.SelectedAccount()
-	if acct == nil {
-		return errors.New("No account selected")
+	h := newHelper(aerc)
+	store, err := h.store()
+	if err != nil {
+		return err
 	}
-	store := widget.Store()
-	if store == nil {
-		return errors.New("Cannot perform action. Messages still loading")
+	uids, err := h.uids()
+	if err != nil {
+		return err
 	}
-	msg, err := widget.SelectedMessage()
+	acct, err := h.account()
 	if err != nil {
 		return err
 	}
-	_, isMsgView := widget.(*widgets.MessageViewer)
+	_, isMsgView := h.msgProvider.(*widgets.MessageViewer)
 	if isMsgView {
-		aerc.RemoveTab(widget)
+		aerc.RemoveTab(h.msgProvider)
 	}
 	store.Next()
 	acct.Messages().Scroll()
 	joinedArgs := strings.Join(args[optind:], " ")
-	store.Move([]uint32{msg.Uid}, joinedArgs, createParents, func(
+	store.Move(uids, joinedArgs, createParents, func(
 		msg types.WorkerMessage) {
 
 		switch msg := msg.(type) {