Revert "Remove duration from the status methods"
This reverts commit f06d683688
.
This commit is contained in:
parent
b9af9b5fb1
commit
76a91813d8
29 changed files with 104 additions and 74 deletions
|
@ -3,6 +3,7 @@ package account
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
"git.sr.ht/~sircmpwn/aerc/worker/types"
|
"git.sr.ht/~sircmpwn/aerc/worker/types"
|
||||||
|
@ -36,10 +37,10 @@ func (MakeDir) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}, func(msg types.WorkerMessage) {
|
}, func(msg types.WorkerMessage) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus("Directory created.")
|
aerc.PushStatus("Directory created.", 10*time.Second)
|
||||||
acct.Directories().Select(name)
|
acct.Directories().Select(name)
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -2,6 +2,7 @@ package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/lib"
|
"git.sr.ht/~sircmpwn/aerc/lib"
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
|
@ -41,7 +42,7 @@ func (ViewMessage) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
lib.NewMessageStoreView(msg, store, aerc.DecryptKeys,
|
lib.NewMessageStoreView(msg, store, aerc.DecryptKeys,
|
||||||
func(view lib.MessageView, err error) {
|
func(view lib.MessageView, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(err.Error())
|
aerc.PushError(err.Error(), 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
viewer := widgets.NewMessageViewer(acct, aerc.Config(), view)
|
viewer := widgets.NewMessageViewer(acct, aerc.Config(), view)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/commands"
|
"git.sr.ht/~sircmpwn/aerc/commands"
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
|
@ -34,23 +35,23 @@ func (Attach) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
|
|
||||||
path, err := homedir.Expand(path)
|
path, err := homedir.Expand(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
pathinfo, err := os.Stat(path)
|
pathinfo, err := os.Stat(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
return err
|
return err
|
||||||
} else if pathinfo.IsDir() {
|
} 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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
composer, _ := aerc.SelectedTab().(*widgets.Composer)
|
composer, _ := aerc.SelectedTab().(*widgets.Composer)
|
||||||
composer.AddAttachment(path)
|
composer.AddAttachment(path)
|
||||||
|
|
||||||
aerc.PushSuccess(fmt.Sprintf("Attached %s", pathinfo.Name()))
|
aerc.PushSuccess(fmt.Sprintf("Attached %s", pathinfo.Name()), 10*time.Second)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package compose
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
)
|
)
|
||||||
|
@ -42,7 +43,7 @@ func (Detach) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
aerc.PushSuccess(fmt.Sprintf("Detached %s", path))
|
aerc.PushSuccess(fmt.Sprintf("Detached %s", path), 10*time.Second)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
go func() {
|
go func() {
|
||||||
errStr := <-errChan
|
errStr := <-errChan
|
||||||
if errStr != "" {
|
if errStr != "" {
|
||||||
aerc.PushError(" " + errStr)
|
aerc.PushError(" "+errStr, 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
ctr := datacounter.NewWriterCounter(ioutil.Discard)
|
ctr := datacounter.NewWriterCounter(ioutil.Discard)
|
||||||
err = composer.WriteMessage(header, ctr)
|
err = composer.WriteMessage(header, ctr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(errors.Wrap(err, "WriteMessage").Error())
|
aerc.PushError(errors.Wrap(err, "WriteMessage").Error(), 10*time.Second)
|
||||||
composer.Close()
|
composer.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -86,11 +86,11 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}, func(msg types.WorkerMessage) {
|
}, func(msg types.WorkerMessage) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus("Message postponed.")
|
aerc.PushStatus("Message postponed.", 10*time.Second)
|
||||||
r.Close()
|
r.Close()
|
||||||
composer.Close()
|
composer.Close()
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
r.Close()
|
r.Close()
|
||||||
composer.Close()
|
composer.Close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,14 +221,14 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
aerc.PushStatus("Sending...")
|
aerc.PushStatus("Sending...", 10*time.Second)
|
||||||
nbytes, err := sendAsync()
|
nbytes, err := sendAsync()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.SetError(" " + err.Error())
|
aerc.SetError(" " + err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if config.CopyTo != "" {
|
if config.CopyTo != "" {
|
||||||
aerc.PushStatus("Copying to " + config.CopyTo)
|
aerc.PushStatus("Copying to "+config.CopyTo, 10*time.Second)
|
||||||
worker := composer.Worker()
|
worker := composer.Worker()
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
worker.PostAction(&types.AppendMessage{
|
worker.PostAction(&types.AppendMessage{
|
||||||
|
@ -240,12 +240,12 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}, func(msg types.WorkerMessage) {
|
}, func(msg types.WorkerMessage) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus("Message sent.")
|
aerc.PushStatus("Message sent.", 10*time.Second)
|
||||||
r.Close()
|
r.Close()
|
||||||
composer.SetSent()
|
composer.SetSent()
|
||||||
composer.Close()
|
composer.Close()
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
r.Close()
|
r.Close()
|
||||||
composer.Close()
|
composer.Close()
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
composer.WriteMessage(header, w)
|
composer.WriteMessage(header, w)
|
||||||
w.Close()
|
w.Close()
|
||||||
} else {
|
} else {
|
||||||
aerc.PushStatus("Message sent.")
|
aerc.PushStatus("Message sent.", 10*time.Second)
|
||||||
composer.SetSent()
|
composer.SetSent()
|
||||||
composer.Close()
|
composer.Close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
)
|
)
|
||||||
|
@ -30,16 +31,16 @@ func (ExecCmd) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
go func() {
|
go func() {
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
} else {
|
} else {
|
||||||
if cmd.ProcessState.ExitCode() != 0 {
|
if cmd.ProcessState.ExitCode() != 0 {
|
||||||
aerc.PushError(fmt.Sprintf(
|
aerc.PushError(fmt.Sprintf(
|
||||||
"%s: completed with status %d", args[0],
|
"%s: completed with status %d", args[0],
|
||||||
cmd.ProcessState.ExitCode()))
|
cmd.ProcessState.ExitCode()), 10*time.Second)
|
||||||
} else {
|
} else {
|
||||||
aerc.PushStatus(fmt.Sprintf(
|
aerc.PushStatus(fmt.Sprintf(
|
||||||
"%s: completed with status %d", args[0],
|
"%s: completed with status %d", args[0],
|
||||||
cmd.ProcessState.ExitCode()))
|
cmd.ProcessState.ExitCode()), 10*time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/commands"
|
"git.sr.ht/~sircmpwn/aerc/commands"
|
||||||
"git.sr.ht/~sircmpwn/aerc/models"
|
"git.sr.ht/~sircmpwn/aerc/models"
|
||||||
|
@ -85,7 +86,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
wg.Done()
|
wg.Done()
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
success = false
|
success = false
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}
|
}
|
||||||
|
@ -95,7 +96,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
go func() {
|
go func() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
if success {
|
if success {
|
||||||
aerc.PushStatus("Messages archived.")
|
aerc.PushStatus("Messages archived.", 10*time.Second)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -3,6 +3,7 @@ package msg
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/getopt"
|
"git.sr.ht/~sircmpwn/getopt"
|
||||||
|
|
||||||
|
@ -57,9 +58,9 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus("Messages copied.")
|
aerc.PushStatus("Messages copied.", 10*time.Second)
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -2,6 +2,7 @@ package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/lib"
|
"git.sr.ht/~sircmpwn/aerc/lib"
|
||||||
"git.sr.ht/~sircmpwn/aerc/models"
|
"git.sr.ht/~sircmpwn/aerc/models"
|
||||||
|
@ -44,9 +45,9 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
store.Delete(uids, func(msg types.WorkerMessage) {
|
store.Delete(uids, func(msg types.WorkerMessage) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus("Messages deleted.")
|
aerc.PushStatus("Messages deleted.", 10*time.Second)
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
lib.NewMessageStoreView(next, store, aerc.DecryptKeys,
|
lib.NewMessageStoreView(next, store, aerc.DecryptKeys,
|
||||||
func(view lib.MessageView, err error) {
|
func(view lib.MessageView, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(err.Error())
|
aerc.PushError(err.Error(), 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view)
|
nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/models"
|
"git.sr.ht/~sircmpwn/aerc/models"
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
|
@ -83,7 +84,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), acct.AccountConfig(),
|
composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), acct.AccountConfig(),
|
||||||
acct.Worker(), template, defaults, original)
|
acct.Worker(), template, defaults, original)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError("Error: " + err.Error())
|
aerc.PushError("Error: "+err.Error(), 10*time.Second)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/commands"
|
"git.sr.ht/~sircmpwn/aerc/commands"
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
|
@ -55,9 +56,9 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus("labels updated")
|
aerc.PushStatus("labels updated", 10*time.Second)
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -3,6 +3,7 @@ package msg
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/getopt"
|
"git.sr.ht/~sircmpwn/getopt"
|
||||||
|
|
||||||
|
@ -68,9 +69,9 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus("Message moved to " + joinedArgs)
|
aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second)
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/commands"
|
"git.sr.ht/~sircmpwn/aerc/commands"
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
|
@ -74,7 +75,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
doTerm := func(reader io.Reader, name string) {
|
doTerm := func(reader io.Reader, name string) {
|
||||||
term, err := commands.QuickTerm(aerc, cmd, reader)
|
term, err := commands.QuickTerm(aerc, cmd, reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
aerc.NewTab(term, name)
|
aerc.NewTab(term, name)
|
||||||
|
@ -92,16 +93,16 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}()
|
}()
|
||||||
err = ecmd.Run()
|
err = ecmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
} else {
|
} else {
|
||||||
if ecmd.ProcessState.ExitCode() != 0 {
|
if ecmd.ProcessState.ExitCode() != 0 {
|
||||||
aerc.PushError(fmt.Sprintf(
|
aerc.PushError(fmt.Sprintf(
|
||||||
"%s: completed with status %d", cmd[0],
|
"%s: completed with status %d", cmd[0],
|
||||||
ecmd.ProcessState.ExitCode()))
|
ecmd.ProcessState.ExitCode()), 10*time.Second)
|
||||||
} else {
|
} else {
|
||||||
aerc.PushStatus(fmt.Sprintf(
|
aerc.PushStatus(fmt.Sprintf(
|
||||||
"%s: completed with status %d", cmd[0],
|
"%s: completed with status %d", cmd[0],
|
||||||
ecmd.ProcessState.ExitCode()))
|
ecmd.ProcessState.ExitCode()), 10*time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package msg
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/getopt"
|
"git.sr.ht/~sircmpwn/getopt"
|
||||||
|
|
||||||
|
@ -90,9 +91,9 @@ func submitReadChange(aerc *widgets.Aerc, store *lib.MessageStore,
|
||||||
store.Read(uids, newState, func(msg types.WorkerMessage) {
|
store.Read(uids, newState, func(msg types.WorkerMessage) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
aerc.PushStatus(msg_success)
|
aerc.PushStatus(msg_success, 10*time.Second)
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,7 @@ func submitReadChangeWg(aerc *widgets.Aerc, store *lib.MessageStore,
|
||||||
case *types.Done:
|
case *types.Done:
|
||||||
wg.Done()
|
wg.Done()
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
*success = false
|
*success = false
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}
|
}
|
||||||
|
@ -135,7 +136,7 @@ func submitToggle(aerc *widgets.Aerc, store *lib.MessageStore, h *helper) error
|
||||||
go func() {
|
go func() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
if success {
|
if success {
|
||||||
aerc.PushStatus(msg_success)
|
aerc.PushStatus(msg_success, 10*time.Second)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -2,6 +2,7 @@ package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/emersion/go-message"
|
"github.com/emersion/go-message"
|
||||||
_ "github.com/emersion/go-message/charset"
|
_ "github.com/emersion/go-message/charset"
|
||||||
|
@ -91,7 +92,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}, func(msg types.WorkerMessage) {
|
}, func(msg types.WorkerMessage) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *types.Error:
|
case *types.Error:
|
||||||
aerc.PushError(" " + msg.Error.Error())
|
aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
|
||||||
composer.Close()
|
composer.Close()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
gomail "net/mail"
|
gomail "net/mail"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/getopt"
|
"git.sr.ht/~sircmpwn/getopt"
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
composer, err := widgets.NewComposer(aerc, acct, aerc.Config(),
|
composer, err := widgets.NewComposer(aerc, acct, aerc.Config(),
|
||||||
acct.AccountConfig(), acct.Worker(), template, defaults, original)
|
acct.AccountConfig(), acct.Worker(), template, defaults, original)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError("Error: " + err.Error())
|
aerc.PushError("Error: "+err.Error(), 10*time.Second)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package msgview
|
package msgview
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/commands/account"
|
"git.sr.ht/~sircmpwn/aerc/commands/account"
|
||||||
"git.sr.ht/~sircmpwn/aerc/lib"
|
"git.sr.ht/~sircmpwn/aerc/lib"
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
|
@ -40,7 +42,7 @@ func (NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
lib.NewMessageStoreView(nextMsg, store, aerc.DecryptKeys,
|
lib.NewMessageStoreView(nextMsg, store, aerc.DecryptKeys,
|
||||||
func(view lib.MessageView, err error) {
|
func(view lib.MessageView, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(err.Error())
|
aerc.PushError(err.Error(), 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view)
|
nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"mime"
|
"mime"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/lib"
|
"git.sr.ht/~sircmpwn/aerc/lib"
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
|
@ -48,23 +49,23 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
|
|
||||||
tmpFile, err := ioutil.TempFile(os.TempDir(), "aerc-*"+extension)
|
tmpFile, err := ioutil.TempFile(os.TempDir(), "aerc-*"+extension)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer tmpFile.Close()
|
defer tmpFile.Close()
|
||||||
|
|
||||||
_, err = io.Copy(tmpFile, reader)
|
_, err = io.Copy(tmpFile, reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = lib.OpenFile(tmpFile.Name())
|
err = lib.OpenFile(tmpFile.Name())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
aerc.PushStatus("Opened")
|
aerc.PushStatus("Opened", 10*time.Second)
|
||||||
})
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -128,10 +128,10 @@ func (Save) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
go func() {
|
go func() {
|
||||||
err := <-ch
|
err := <-ch
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(fmt.Sprintf("Save failed: %v", err))
|
aerc.PushError(fmt.Sprintf("Save failed: %v", err), 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
aerc.PushStatus("Saved to " + path)
|
aerc.PushStatus("Saved to "+path, 10*time.Second)
|
||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package commands
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/widgets"
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
||||||
)
|
)
|
||||||
|
@ -29,6 +30,6 @@ func (PrintWorkDir) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
aerc.PushStatus(pwd)
|
aerc.PushStatus(pwd, 10*time.Second)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/riywo/loginshell"
|
"github.com/riywo/loginshell"
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ func TermCore(aerc *widgets.Aerc, args []string) error {
|
||||||
term.OnClose = func(err error) {
|
term.OnClose = func(err error) {
|
||||||
aerc.RemoveTab(term)
|
aerc.RemoveTab(term)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.sr.ht/~sircmpwn/aerc/lib"
|
"git.sr.ht/~sircmpwn/aerc/lib"
|
||||||
"git.sr.ht/~sircmpwn/aerc/models"
|
"git.sr.ht/~sircmpwn/aerc/models"
|
||||||
|
@ -31,11 +32,12 @@ func QuickTerm(aerc *widgets.Aerc, args []string, stdin io.Reader) (*widgets.Ter
|
||||||
|
|
||||||
term.OnClose = func(err error) {
|
term.OnClose = func(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
// remove the tab on error, otherwise it gets stuck
|
// remove the tab on error, otherwise it gets stuck
|
||||||
aerc.RemoveTab(term)
|
aerc.RemoveTab(term)
|
||||||
} else {
|
} else {
|
||||||
aerc.PushStatus("Process complete, press any key to close.")
|
aerc.PushStatus("Process complete, press any key to close.",
|
||||||
|
10*time.Second)
|
||||||
term.OnEvent = func(event tcell.Event) bool {
|
term.OnEvent = func(event tcell.Event) bool {
|
||||||
aerc.RemoveTab(term)
|
aerc.RemoveTab(term)
|
||||||
return true
|
return true
|
||||||
|
@ -54,7 +56,7 @@ func QuickTerm(aerc *widgets.Aerc, args []string, stdin io.Reader) (*widgets.Ter
|
||||||
|
|
||||||
err := <-status
|
err := <-status
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gdamore/tcell"
|
"github.com/gdamore/tcell"
|
||||||
"github.com/go-ini/ini"
|
"github.com/go-ini/ini"
|
||||||
|
@ -428,7 +429,7 @@ func (wizard *AccountWizard) ConfigureTemporaryAccount(temporary bool) {
|
||||||
|
|
||||||
func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
|
func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
|
||||||
if d == nil {
|
if d == nil {
|
||||||
wizard.aerc.PushError(" " + err.Error())
|
wizard.aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
wizard.Invalidate()
|
wizard.Invalidate()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -443,7 +444,7 @@ func (wizard *AccountWizard) errorFor(d ui.Interactive, err error) {
|
||||||
wizard.step = step
|
wizard.step = step
|
||||||
wizard.focus = focus
|
wizard.focus = focus
|
||||||
wizard.Focus(true)
|
wizard.Focus(true)
|
||||||
wizard.aerc.PushError(" " + err.Error())
|
wizard.aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
wizard.Invalidate()
|
wizard.Invalidate()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -554,7 +555,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
|
||||||
term.OnClose = func(err error) {
|
term.OnClose = func(err error) {
|
||||||
wizard.aerc.RemoveTab(term)
|
wizard.aerc.RemoveTab(term)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wizard.aerc.PushError(" " + err.Error())
|
wizard.aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gdamore/tcell"
|
"github.com/gdamore/tcell"
|
||||||
|
|
||||||
|
@ -289,7 +290,7 @@ func (acct *AccountView) getSortCriteria() []*types.SortCriterion {
|
||||||
}
|
}
|
||||||
criteria, err := sort.GetSortCriteria(acct.UiConfig().Sort)
|
criteria, err := sort.GetSortCriteria(acct.UiConfig().Sort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
acct.aerc.PushError(" ui.sort: " + err.Error())
|
acct.aerc.PushError(" ui.sort: "+err.Error(), 10*time.Second)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return criteria
|
return criteria
|
||||||
|
|
|
@ -386,16 +386,16 @@ func (aerc *Aerc) SetError(status string) *StatusMessage {
|
||||||
return aerc.statusline.SetError(status)
|
return aerc.statusline.SetError(status)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aerc *Aerc) PushStatus(text string) *StatusMessage {
|
func (aerc *Aerc) PushStatus(text string, expiry time.Duration) *StatusMessage {
|
||||||
return aerc.statusline.Push(text, 10*time.Second)
|
return aerc.statusline.Push(text, expiry)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aerc *Aerc) PushError(text string) *StatusMessage {
|
func (aerc *Aerc) PushError(text string, expiry time.Duration) *StatusMessage {
|
||||||
return aerc.statusline.PushError(text, 10*time.Second)
|
return aerc.statusline.PushError(text, expiry)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aerc *Aerc) PushSuccess(text string) *StatusMessage {
|
func (aerc *Aerc) PushSuccess(text string, expiry time.Duration) *StatusMessage {
|
||||||
return aerc.statusline.PushSuccess(text, 10*time.Second)
|
return aerc.statusline.PushSuccess(text, expiry)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aerc *Aerc) focus(item ui.Interactive) {
|
func (aerc *Aerc) focus(item ui.Interactive) {
|
||||||
|
@ -424,11 +424,11 @@ func (aerc *Aerc) BeginExCommand(cmd string) {
|
||||||
exline := NewExLine(aerc.conf, cmd, func(cmd string) {
|
exline := NewExLine(aerc.conf, cmd, func(cmd string) {
|
||||||
parts, err := shlex.Split(cmd)
|
parts, err := shlex.Split(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
err = aerc.cmd(parts)
|
err = aerc.cmd(parts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
// only add to history if this is an unsimulated command,
|
// only add to history if this is an unsimulated command,
|
||||||
// ie one not executed from a keybinding
|
// ie one not executed from a keybinding
|
||||||
|
@ -452,7 +452,7 @@ func (aerc *Aerc) RegisterPrompt(prompt string, cmd []string) {
|
||||||
}
|
}
|
||||||
err := aerc.cmd(cmd)
|
err := aerc.cmd(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
}, func(cmd string) []string {
|
}, func(cmd string) []string {
|
||||||
return nil // TODO: completions
|
return nil // TODO: completions
|
||||||
|
@ -479,7 +479,7 @@ func (aerc *Aerc) RegisterChoices(choices []Choice) {
|
||||||
}
|
}
|
||||||
err := aerc.cmd(cmd)
|
err := aerc.cmd(cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aerc.PushError(" " + err.Error())
|
aerc.PushError(" "+err.Error(), 10*time.Second)
|
||||||
}
|
}
|
||||||
}, func(cmd string) []string {
|
}, func(cmd string) []string {
|
||||||
return nil // TODO: completions
|
return nil // TODO: completions
|
||||||
|
|
|
@ -73,7 +73,7 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig,
|
||||||
templateData := templates.ParseTemplateData(defaults, original)
|
templateData := templates.ParseTemplateData(defaults, original)
|
||||||
cmpl := completer.New(conf.Compose.AddressBookCmd, func(err error) {
|
cmpl := completer.New(conf.Compose.AddressBookCmd, func(err error) {
|
||||||
aerc.PushError(
|
aerc.PushError(
|
||||||
fmt.Sprintf("could not complete header: %v", err))
|
fmt.Sprintf("could not complete header: %v", err), 10*time.Second)
|
||||||
worker.Logger.Printf("could not complete header: %v", err)
|
worker.Logger.Printf("could not complete header: %v", err)
|
||||||
}, aerc.Logger())
|
}, aerc.Logger())
|
||||||
layout, editors, focusable := buildComposeHeader(aerc, cmpl, defaults)
|
layout, editors, focusable := buildComposeHeader(aerc, cmpl, defaults)
|
||||||
|
@ -261,7 +261,8 @@ func (c *Composer) readSignatureFromFile() []byte {
|
||||||
signature, err := ioutil.ReadFile(sigFile)
|
signature, err := ioutil.ReadFile(sigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.aerc.PushError(
|
c.aerc.PushError(
|
||||||
fmt.Sprintf(" Error loading signature from file: %v", sigFile))
|
fmt.Sprintf(" Error loading signature from file: %v", sigFile),
|
||||||
|
10*time.Second)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return signature
|
return signature
|
||||||
|
|
|
@ -3,6 +3,7 @@ package widgets
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gdamore/tcell"
|
"github.com/gdamore/tcell"
|
||||||
"github.com/mattn/go-runewidth"
|
"github.com/mattn/go-runewidth"
|
||||||
|
@ -185,7 +186,7 @@ func (ml *MessageList) MouseEvent(localX int, localY int, event tcell.Event) {
|
||||||
lib.NewMessageStoreView(msg, store, ml.aerc.DecryptKeys,
|
lib.NewMessageStoreView(msg, store, ml.aerc.DecryptKeys,
|
||||||
func(view lib.MessageView, err error) {
|
func(view lib.MessageView, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ml.aerc.PushError(err.Error())
|
ml.aerc.PushError(err.Error(), 10*time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
viewer := NewMessageViewer(acct, ml.aerc.Config(), view)
|
viewer := NewMessageViewer(acct, ml.aerc.Config(), view)
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package widgets
|
package widgets
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type TabHost interface {
|
type TabHost interface {
|
||||||
BeginExCommand(cmd string)
|
BeginExCommand(cmd string)
|
||||||
SetStatus(status string) *StatusMessage
|
SetStatus(status string) *StatusMessage
|
||||||
SetError(err string) *StatusMessage
|
SetError(err string) *StatusMessage
|
||||||
PushStatus(text string) *StatusMessage
|
PushStatus(text string, expiry time.Duration) *StatusMessage
|
||||||
PushError(text string) *StatusMessage
|
PushError(text string, expiry time.Duration) *StatusMessage
|
||||||
PushSuccess(text string) *StatusMessage
|
PushSuccess(text string, expiry time.Duration) *StatusMessage
|
||||||
Beep()
|
Beep()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue