diff options
author | Drew DeVault <sir@cmpwn.com> | 2020-05-28 10:32:32 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-05-28 10:32:32 -0400 |
commit | 76a91813d8dc0f0011202f8120fc197097f022aa (patch) | |
tree | ff4cd6581d3af0911954a37550602366d2bb0e2f /commands/compose | |
parent | b9af9b5fb1c4f226499ab9c56d3e24f2b9b2db24 (diff) | |
download | aerc-76a91813d8dc0f0011202f8120fc197097f022aa.tar.gz |
Revert "Remove duration from the status methods"
This reverts commit f06d683688e3d2139b14f67b7e349089e7200bf4.
Diffstat (limited to 'commands/compose')
-rw-r--r-- | commands/compose/attach.go | 9 | ||||
-rw-r--r-- | commands/compose/detach.go | 3 | ||||
-rw-r--r-- | commands/compose/postpone.go | 8 | ||||
-rw-r--r-- | commands/compose/send.go | 10 |
4 files changed, 16 insertions, 14 deletions
diff --git a/commands/compose/attach.go b/commands/compose/attach.go index 148442b0..6b8d72fc 100644 --- a/commands/compose/attach.go +++ b/commands/compose/attach.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "strings" + "time" "git.sr.ht/~sircmpwn/aerc/commands" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -34,23 +35,23 @@ func (Attach) Execute(aerc *widgets.Aerc, args []string) error { path, err := homedir.Expand(path) if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(" "+err.Error(), 10*time.Second) return err } pathinfo, err := os.Stat(path) if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(" "+err.Error(), 10*time.Second) return err } else if pathinfo.IsDir() { - aerc.PushError("Attachment must be a file, not a directory") + aerc.PushError("Attachment must be a file, not a directory", 10*time.Second) return nil } composer, _ := aerc.SelectedTab().(*widgets.Composer) composer.AddAttachment(path) - aerc.PushSuccess(fmt.Sprintf("Attached %s", pathinfo.Name())) + aerc.PushSuccess(fmt.Sprintf("Attached %s", pathinfo.Name()), 10*time.Second) return nil } diff --git a/commands/compose/detach.go b/commands/compose/detach.go index b48159d0..8bc0e887 100644 --- a/commands/compose/detach.go +++ b/commands/compose/detach.go @@ -3,6 +3,7 @@ package compose import ( "fmt" "strings" + "time" "git.sr.ht/~sircmpwn/aerc/widgets" ) @@ -42,7 +43,7 @@ func (Detach) Execute(aerc *widgets.Aerc, args []string) error { return err } - aerc.PushSuccess(fmt.Sprintf("Detached %s", path)) + aerc.PushSuccess(fmt.Sprintf("Detached %s", path), 10*time.Second) return nil } diff --git a/commands/compose/postpone.go b/commands/compose/postpone.go index 4427ff66..90b6134b 100644 --- a/commands/compose/postpone.go +++ b/commands/compose/postpone.go @@ -63,7 +63,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error { go func() { errStr := <-errChan if errStr != "" { - aerc.PushError(" " + errStr) + aerc.PushError(" "+errStr, 10*time.Second) return } @@ -71,7 +71,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error { ctr := datacounter.NewWriterCounter(ioutil.Discard) err = composer.WriteMessage(header, ctr) if err != nil { - aerc.PushError(errors.Wrap(err, "WriteMessage").Error()) + aerc.PushError(errors.Wrap(err, "WriteMessage").Error(), 10*time.Second) composer.Close() return } @@ -86,11 +86,11 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error { }, func(msg types.WorkerMessage) { switch msg := msg.(type) { case *types.Done: - aerc.PushStatus("Message postponed.") + aerc.PushStatus("Message postponed.", 10*time.Second) r.Close() composer.Close() case *types.Error: - aerc.PushError(" " + msg.Error.Error()) + aerc.PushError(" "+msg.Error.Error(), 10*time.Second) r.Close() composer.Close() } diff --git a/commands/compose/send.go b/commands/compose/send.go index e7ace858..a22be8f8 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -221,14 +221,14 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error { } go func() { - aerc.PushStatus("Sending...") + aerc.PushStatus("Sending...", 10*time.Second) nbytes, err := sendAsync() if err != nil { aerc.SetError(" " + err.Error()) return } if config.CopyTo != "" { - aerc.PushStatus("Copying to " + config.CopyTo) + aerc.PushStatus("Copying to "+config.CopyTo, 10*time.Second) worker := composer.Worker() r, w := io.Pipe() worker.PostAction(&types.AppendMessage{ @@ -240,12 +240,12 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error { }, func(msg types.WorkerMessage) { switch msg := msg.(type) { case *types.Done: - aerc.PushStatus("Message sent.") + aerc.PushStatus("Message sent.", 10*time.Second) r.Close() composer.SetSent() composer.Close() case *types.Error: - aerc.PushError(" " + msg.Error.Error()) + aerc.PushError(" "+msg.Error.Error(), 10*time.Second) r.Close() composer.Close() } @@ -254,7 +254,7 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error { composer.WriteMessage(header, w) w.Close() } else { - aerc.PushStatus("Message sent.") + aerc.PushStatus("Message sent.", 10*time.Second) composer.SetSent() composer.Close() } |