From f06d683688e3d2139b14f67b7e349089e7200bf4 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Wed, 27 May 2020 07:52:13 +0200 Subject: Remove duration from the status methods We always set 10 seconds anyhow, might as well do that without repeating ourselfs. --- commands/msg/archive.go | 5 ++--- commands/msg/copy.go | 5 ++--- commands/msg/delete.go | 7 +++---- commands/msg/forward.go | 3 +-- commands/msg/modify-labels.go | 5 ++--- commands/msg/move.go | 5 ++--- commands/msg/pipe.go | 9 ++++----- commands/msg/read.go | 9 ++++----- commands/msg/recall.go | 3 +-- commands/msg/reply.go | 3 +-- 10 files changed, 22 insertions(+), 32 deletions(-) (limited to 'commands/msg') diff --git a/commands/msg/archive.go b/commands/msg/archive.go index ba7e1f7f..afd0d55e 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -5,7 +5,6 @@ import ( "fmt" "path" "sync" - "time" "git.sr.ht/~sircmpwn/aerc/commands" "git.sr.ht/~sircmpwn/aerc/models" @@ -86,7 +85,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: wg.Done() case *types.Error: - aerc.PushError(" "+msg.Error.Error(), 10*time.Second) + aerc.PushError(" " + msg.Error.Error()) success = false wg.Done() } @@ -96,7 +95,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error { go func() { wg.Wait() if success { - aerc.PushStatus("Messages archived.", 10*time.Second) + aerc.PushStatus("Messages archived.") } }() return nil diff --git a/commands/msg/copy.go b/commands/msg/copy.go index e822c5c1..9a8bcb83 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -3,7 +3,6 @@ package msg import ( "errors" "strings" - "time" "git.sr.ht/~sircmpwn/getopt" @@ -58,9 +57,9 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error { switch msg := msg.(type) { case *types.Done: - aerc.PushStatus("Messages copied.", 10*time.Second) + aerc.PushStatus("Messages copied.") case *types.Error: - aerc.PushError(" "+msg.Error.Error(), 10*time.Second) + aerc.PushError(" " + msg.Error.Error()) } }) return nil diff --git a/commands/msg/delete.go b/commands/msg/delete.go index 482b60c1..46633838 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -2,7 +2,6 @@ package msg import ( "errors" - "time" "git.sr.ht/~sircmpwn/aerc/lib" "git.sr.ht/~sircmpwn/aerc/models" @@ -45,9 +44,9 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error { store.Delete(uids, func(msg types.WorkerMessage) { switch msg := msg.(type) { case *types.Done: - aerc.PushStatus("Messages deleted.", 10*time.Second) + aerc.PushStatus("Messages deleted.") case *types.Error: - aerc.PushError(" "+msg.Error.Error(), 10*time.Second) + aerc.PushError(" " + msg.Error.Error()) } }) @@ -68,7 +67,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error { lib.NewMessageStoreView(next, store, aerc.DecryptKeys, func(view lib.MessageView, err error) { if err != nil { - aerc.PushError(err.Error(), 10*time.Second) + aerc.PushError(err.Error()) return } nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view) diff --git a/commands/msg/forward.go b/commands/msg/forward.go index 5dd51b29..28abbed1 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -9,7 +9,6 @@ import ( "os" "path" "strings" - "time" "git.sr.ht/~sircmpwn/aerc/models" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -84,7 +83,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), acct.AccountConfig(), acct.Worker(), template, defaults, original) if err != nil { - aerc.PushError("Error: "+err.Error(), 10*time.Second) + aerc.PushError("Error: " + err.Error()) return nil, err } diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go index d74aece5..02e64786 100644 --- a/commands/msg/modify-labels.go +++ b/commands/msg/modify-labels.go @@ -2,7 +2,6 @@ package msg import ( "errors" - "time" "git.sr.ht/~sircmpwn/aerc/commands" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -56,9 +55,9 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error { switch msg := msg.(type) { case *types.Done: - aerc.PushStatus("labels updated", 10*time.Second) + aerc.PushStatus("labels updated") case *types.Error: - aerc.PushError(" "+msg.Error.Error(), 10*time.Second) + aerc.PushError(" " + msg.Error.Error()) } }) return nil diff --git a/commands/msg/move.go b/commands/msg/move.go index a19194ee..504beda9 100644 --- a/commands/msg/move.go +++ b/commands/msg/move.go @@ -3,7 +3,6 @@ package msg import ( "errors" "strings" - "time" "git.sr.ht/~sircmpwn/getopt" @@ -69,9 +68,9 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error { switch msg := msg.(type) { case *types.Done: - aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second) + aerc.PushStatus("Message moved to " + joinedArgs) case *types.Error: - aerc.PushError(" "+msg.Error.Error(), 10*time.Second) + aerc.PushError(" " + msg.Error.Error()) } }) return nil diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 15b8c52a..15e0fdab 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -5,7 +5,6 @@ import ( "fmt" "io" "os/exec" - "time" "git.sr.ht/~sircmpwn/aerc/commands" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -75,7 +74,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { doTerm := func(reader io.Reader, name string) { term, err := commands.QuickTerm(aerc, cmd, reader) if err != nil { - aerc.PushError(" "+err.Error(), 10*time.Second) + aerc.PushError(" " + err.Error()) return } aerc.NewTab(term, name) @@ -93,16 +92,16 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { }() err = ecmd.Run() if err != nil { - aerc.PushError(" "+err.Error(), 10*time.Second) + aerc.PushError(" " + err.Error()) } else { if ecmd.ProcessState.ExitCode() != 0 { aerc.PushError(fmt.Sprintf( "%s: completed with status %d", cmd[0], - ecmd.ProcessState.ExitCode()), 10*time.Second) + ecmd.ProcessState.ExitCode())) } else { aerc.PushStatus(fmt.Sprintf( "%s: completed with status %d", cmd[0], - ecmd.ProcessState.ExitCode()), 10*time.Second) + ecmd.ProcessState.ExitCode())) } } } diff --git a/commands/msg/read.go b/commands/msg/read.go index e27f7433..a08b8074 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -3,7 +3,6 @@ package msg import ( "errors" "sync" - "time" "git.sr.ht/~sircmpwn/getopt" @@ -91,9 +90,9 @@ func submitReadChange(aerc *widgets.Aerc, store *lib.MessageStore, store.Read(uids, newState, func(msg types.WorkerMessage) { switch msg := msg.(type) { case *types.Done: - aerc.PushStatus(msg_success, 10*time.Second) + aerc.PushStatus(msg_success) case *types.Error: - aerc.PushError(" "+msg.Error.Error(), 10*time.Second) + aerc.PushError(" " + msg.Error.Error()) } }) } @@ -106,7 +105,7 @@ func submitReadChangeWg(aerc *widgets.Aerc, store *lib.MessageStore, case *types.Done: wg.Done() case *types.Error: - aerc.PushError(" "+msg.Error.Error(), 10*time.Second) + aerc.PushError(" " + msg.Error.Error()) *success = false wg.Done() } @@ -136,7 +135,7 @@ func submitToggle(aerc *widgets.Aerc, store *lib.MessageStore, h *helper) error go func() { wg.Wait() if success { - aerc.PushStatus(msg_success, 10*time.Second) + aerc.PushStatus(msg_success) } }() return nil diff --git a/commands/msg/recall.go b/commands/msg/recall.go index 6c5e9736..7c9ac193 100644 --- a/commands/msg/recall.go +++ b/commands/msg/recall.go @@ -2,7 +2,6 @@ package msg import ( "io" - "time" "github.com/emersion/go-message" _ "github.com/emersion/go-message/charset" @@ -92,7 +91,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { }, func(msg types.WorkerMessage) { switch msg := msg.(type) { case *types.Error: - aerc.PushError(" "+msg.Error.Error(), 10*time.Second) + aerc.PushError(" " + msg.Error.Error()) composer.Close() } }) diff --git a/commands/msg/reply.go b/commands/msg/reply.go index 455c7ca5..28ce245d 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -7,7 +7,6 @@ import ( "io" gomail "net/mail" "strings" - "time" "git.sr.ht/~sircmpwn/getopt" @@ -140,7 +139,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), acct.AccountConfig(), acct.Worker(), template, defaults, original) if err != nil { - aerc.PushError("Error: "+err.Error(), 10*time.Second) + aerc.PushError("Error: " + err.Error()) return err } -- cgit