diff options
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 148442b..6b8d72f 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 b48159d..8bc0e88 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 4427ff6..90b6134 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 e7ace85..a22be8f 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() } |