diff options
Diffstat (limited to 'commands/msg')
-rw-r--r-- | commands/msg/archive.go | 8 | ||||
-rw-r--r-- | commands/msg/copy.go | 6 | ||||
-rw-r--r-- | commands/msg/delete.go | 10 | ||||
-rw-r--r-- | commands/msg/envelope.go | 10 | ||||
-rw-r--r-- | commands/msg/fold.go | 6 | ||||
-rw-r--r-- | commands/msg/forward.go | 14 | ||||
-rw-r--r-- | commands/msg/invite.go | 10 | ||||
-rw-r--r-- | commands/msg/mark.go | 6 | ||||
-rw-r--r-- | commands/msg/modify-labels.go | 6 | ||||
-rw-r--r-- | commands/msg/move.go | 14 | ||||
-rw-r--r-- | commands/msg/pipe.go | 16 | ||||
-rw-r--r-- | commands/msg/read.go | 6 | ||||
-rw-r--r-- | commands/msg/recall.go | 14 | ||||
-rw-r--r-- | commands/msg/reply.go | 18 | ||||
-rw-r--r-- | commands/msg/toggle-thread-context.go | 6 | ||||
-rw-r--r-- | commands/msg/toggle-threads.go | 6 | ||||
-rw-r--r-- | commands/msg/unsubscribe.go | 22 | ||||
-rw-r--r-- | commands/msg/utils.go | 10 |
18 files changed, 94 insertions, 94 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go index 1c9d7929..9753f664 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -6,10 +6,10 @@ import ( "strings" "sync" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/commands" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -29,12 +29,12 @@ func (Archive) Aliases() []string { return []string{"archive"} } -func (Archive) Complete(aerc *widgets.Aerc, args []string) []string { +func (Archive) Complete(aerc *app.Aerc, args []string) []string { valid := []string{"flat", "year", "month"} return commands.CompletionFromList(aerc, valid, args) } -func (Archive) Execute(aerc *widgets.Aerc, args []string) error { +func (Archive) Execute(aerc *app.Aerc, args []string) error { if len(args) != 2 { return errors.New("Usage: archive <flat|year|month>") } @@ -47,7 +47,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error { return err } -func archive(aerc *widgets.Aerc, msgs []*models.MessageInfo, archiveType string) error { +func archive(aerc *app.Aerc, msgs []*models.MessageInfo, archiveType string) error { h := newHelper(aerc) acct, err := h.account() if err != nil { diff --git a/commands/msg/copy.go b/commands/msg/copy.go index 7118e4f8..3f3498a2 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -7,8 +7,8 @@ import ( "git.sr.ht/~sircmpwn/getopt" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/commands" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -22,11 +22,11 @@ func (Copy) Aliases() []string { return []string{"cp", "copy"} } -func (Copy) Complete(aerc *widgets.Aerc, args []string) []string { +func (Copy) Complete(aerc *app.Aerc, args []string) []string { return commands.GetFolders(aerc, args) } -func (Copy) Execute(aerc *widgets.Aerc, args []string) error { +func (Copy) Execute(aerc *app.Aerc, args []string) error { if len(args) == 1 { return errors.New("Usage: cp [-p] <folder>") } diff --git a/commands/msg/delete.go b/commands/msg/delete.go index 6d3fb4a3..37103da3 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -4,11 +4,11 @@ import ( "errors" "time" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -22,11 +22,11 @@ func (Delete) Aliases() []string { return []string{"delete", "delete-message"} } -func (Delete) Complete(aerc *widgets.Aerc, args []string) []string { +func (Delete) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (Delete) Execute(aerc *widgets.Aerc, args []string) error { +func (Delete) Execute(aerc *app.Aerc, args []string) error { if len(args) != 1 { return errors.New("Usage: :delete") } @@ -53,7 +53,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error { switch msg := msg.(type) { case *types.Done: aerc.PushStatus("Messages deleted.", 10*time.Second) - mv, isMsgView := h.msgProvider.(*widgets.MessageViewer) + mv, isMsgView := h.msgProvider.(*app.MessageViewer) if isMsgView { if !config.Ui.NextMessageOnDelete { aerc.RemoveTab(h.msgProvider, true) @@ -72,7 +72,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error { aerc.PushError(err.Error()) return } - nextMv := widgets.NewMessageViewer(acct, view) + nextMv := app.NewMessageViewer(acct, view) aerc.ReplaceTab(mv, nextMv, next.Envelope.Subject, true) }) } diff --git a/commands/msg/envelope.go b/commands/msg/envelope.go index 1b16d16f..f5e50358 100644 --- a/commands/msg/envelope.go +++ b/commands/msg/envelope.go @@ -5,10 +5,10 @@ import ( "fmt" "strings" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/lib/format" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~sircmpwn/getopt" "github.com/emersion/go-message/mail" ) @@ -23,11 +23,11 @@ func (Envelope) Aliases() []string { return []string{"envelope"} } -func (Envelope) Complete(aerc *widgets.Aerc, args []string) []string { +func (Envelope) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (Envelope) Execute(aerc *widgets.Aerc, args []string) error { +func (Envelope) Execute(aerc *app.Aerc, args []string) error { header := false fmtStr := "%-20.20s: %s" opts, _, err := getopt.Getopts(args, "hs:") @@ -65,8 +65,8 @@ func (Envelope) Execute(aerc *widgets.Aerc, args []string) error { } n := len(list) - aerc.AddDialog(widgets.NewDialog( - widgets.NewListBox( + aerc.AddDialog(app.NewDialog( + app.NewListBox( "Message Envelope. Press <Esc> or <Enter> to close. "+ "Start typing to filter.", list, diff --git a/commands/msg/fold.go b/commands/msg/fold.go index 14d00f17..755a292f 100644 --- a/commands/msg/fold.go +++ b/commands/msg/fold.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/lib/ui" - "git.sr.ht/~rjarry/aerc/widgets" ) type Fold struct{} @@ -19,11 +19,11 @@ func (Fold) Aliases() []string { return []string{"fold", "unfold"} } -func (Fold) Complete(aerc *widgets.Aerc, args []string) []string { +func (Fold) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (Fold) Execute(aerc *widgets.Aerc, args []string) error { +func (Fold) Execute(aerc *app.Aerc, args []string) error { if len(args) != 1 { return fmt.Errorf("Usage: %s", args[0]) } diff --git a/commands/msg/forward.go b/commands/msg/forward.go index 86c52059..d1abbc5b 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -12,12 +12,12 @@ import ( "strings" "sync" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/format" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" "github.com/emersion/go-message/mail" @@ -34,11 +34,11 @@ func (forward) Aliases() []string { return []string{"forward"} } -func (forward) Complete(aerc *widgets.Aerc, args []string) []string { +func (forward) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (forward) Execute(aerc *widgets.Aerc, args []string) error { +func (forward) Execute(aerc *app.Aerc, args []string) error { opts, optind, err := getopt.Getopts(args, "AFT:eE") if err != nil { return err @@ -69,7 +69,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("Options -A and -F are mutually exclusive") } - widget := aerc.SelectedTabContent().(widgets.ProvidesMessage) + widget := aerc.SelectedTabContent().(app.ProvidesMessage) acct := widget.SelectedAccount() if acct == nil { return errors.New("No account selected") @@ -106,8 +106,8 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { RFC822Headers: msg.RFC822Headers, } - addTab := func() (*widgets.Composer, error) { - composer, err := widgets.NewComposer(aerc, acct, + addTab := func() (*app.Composer, error) { + composer, err := app.NewComposer(aerc, acct, acct.AccountConfig(), acct.Worker(), editHeaders, template, h, &original, nil) if err != nil { @@ -153,7 +153,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { return } composer.AddAttachment(tmpFileName) - composer.OnClose(func(_ *widgets.Composer) { + composer.OnClose(func(_ *app.Composer) { os.RemoveAll(tmpDir) }) }) diff --git a/commands/msg/invite.go b/commands/msg/invite.go index 309fe643..ceb043bb 100644 --- a/commands/msg/invite.go +++ b/commands/msg/invite.go @@ -5,13 +5,13 @@ import ( "fmt" "io" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/calendar" "git.sr.ht/~rjarry/aerc/lib/format" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~sircmpwn/getopt" "github.com/emersion/go-message/mail" ) @@ -26,11 +26,11 @@ func (invite) Aliases() []string { return []string{"accept", "accept-tentative", "decline"} } -func (invite) Complete(aerc *widgets.Aerc, args []string) []string { +func (invite) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (invite) Execute(aerc *widgets.Aerc, args []string) error { +func (invite) Execute(aerc *app.Aerc, args []string) error { acct := aerc.SelectedAccount() if acct == nil { return errors.New("no account selected") @@ -155,7 +155,7 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error { } addTab := func(cr *calendar.Reply) error { - composer, err := widgets.NewComposer(aerc, acct, + composer, err := app.NewComposer(aerc, acct, acct.AccountConfig(), acct.Worker(), editHeaders, "", h, &original, cr.PlainText) if err != nil { @@ -170,7 +170,7 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error { composer.Tab = aerc.NewTab(composer, subject) - composer.OnClose(func(c *widgets.Composer) { + composer.OnClose(func(c *app.Composer) { if c.Sent() { store.Answered([]uint32{msg.Uid}, true, nil) } diff --git a/commands/msg/mark.go b/commands/msg/mark.go index 51aa1eb4..27677609 100644 --- a/commands/msg/mark.go +++ b/commands/msg/mark.go @@ -3,7 +3,7 @@ package msg import ( "fmt" - "git.sr.ht/~rjarry/aerc/widgets" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~sircmpwn/getopt" ) @@ -17,11 +17,11 @@ func (Mark) Aliases() []string { return []string{"mark", "unmark", "remark"} } -func (Mark) Complete(aerc *widgets.Aerc, args []string) []string { +func (Mark) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (Mark) Execute(aerc *widgets.Aerc, args []string) error { +func (Mark) Execute(aerc *app.Aerc, args []string) error { h := newHelper(aerc) OnSelectedMessage := func(fn func(uint32)) error { if fn == nil { diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go index 02eed520..d61dc23b 100644 --- a/commands/msg/modify-labels.go +++ b/commands/msg/modify-labels.go @@ -4,8 +4,8 @@ import ( "errors" "time" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/commands" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -19,11 +19,11 @@ func (ModifyLabels) Aliases() []string { return []string{"modify-labels", "tag"} } -func (ModifyLabels) Complete(aerc *widgets.Aerc, args []string) []string { +func (ModifyLabels) Complete(aerc *app.Aerc, args []string) []string { return commands.GetLabels(aerc, args) } -func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error { +func (ModifyLabels) Execute(aerc *app.Aerc, args []string) error { changes := args[1:] if len(changes) == 0 { return errors.New("Usage: modify-labels <[+-]label> ...") diff --git a/commands/msg/move.go b/commands/msg/move.go index e8661a61..847fa549 100644 --- a/commands/msg/move.go +++ b/commands/msg/move.go @@ -5,12 +5,12 @@ import ( "strings" "time" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/commands" "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" "git.sr.ht/~sircmpwn/getopt" ) @@ -25,11 +25,11 @@ func (Move) Aliases() []string { return []string{"mv", "move"} } -func (Move) Complete(aerc *widgets.Aerc, args []string) []string { +func (Move) Complete(aerc *app.Aerc, args []string) []string { return commands.GetFolders(aerc, args) } -func (Move) Execute(aerc *widgets.Aerc, args []string) error { +func (Move) Execute(aerc *app.Aerc, args []string) error { if len(args) == 1 { return errors.New("Usage: mv [-p] <folder>") } @@ -82,15 +82,15 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error { } func handleDone( - aerc *widgets.Aerc, - acct *widgets.AccountView, + aerc *app.Aerc, + acct *app.AccountView, next *models.MessageInfo, message string, store *lib.MessageStore, ) { h := newHelper(aerc) aerc.PushStatus(message, 10*time.Second) - mv, isMsgView := h.msgProvider.(*widgets.MessageViewer) + mv, isMsgView := h.msgProvider.(*app.MessageViewer) switch { case isMsgView && !config.Ui.NextMessageOnDelete: aerc.RemoveTab(h.msgProvider, true) @@ -108,7 +108,7 @@ func handleDone( aerc.PushError(err.Error()) return } - nextMv := widgets.NewMessageViewer(acct, view) + nextMv := app.NewMessageViewer(acct, view) aerc.ReplaceTab(mv, nextMv, next.Envelope.Subject, true) }) default: diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index fc1ac8f8..e8c1e277 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -9,9 +9,9 @@ import ( "sort" "time" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/commands" "git.sr.ht/~rjarry/aerc/log" - "git.sr.ht/~rjarry/aerc/widgets" mboxer "git.sr.ht/~rjarry/aerc/worker/mbox" "git.sr.ht/~rjarry/aerc/worker/types" @@ -28,11 +28,11 @@ func (Pipe) Aliases() []string { return []string{"pipe"} } -func (Pipe) Complete(aerc *widgets.Aerc, args []string) []string { +func (Pipe) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { +func (Pipe) Execute(aerc *app.Aerc, args []string) error { var ( background bool pipeFull bool @@ -64,11 +64,11 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("Usage: pipe [-mp] <cmd> [args...]") } - provider := aerc.SelectedTabContent().(widgets.ProvidesMessage) + provider := aerc.SelectedTabContent().(app.ProvidesMessage) if !pipeFull && !pipePart { - if _, ok := provider.(*widgets.MessageViewer); ok { + if _, ok := provider.(*app.MessageViewer); ok { pipePart = true - } else if _, ok := provider.(*widgets.AccountView); ok { + } else if _, ok := provider.(*app.AccountView); ok { pipeFull = true } else { return errors.New( @@ -123,7 +123,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { h := newHelper(aerc) store, err := h.store() if err != nil { - if mv, ok := provider.(*widgets.MessageViewer); ok { + if mv, ok := provider.(*app.MessageViewer); ok { mv.MessageView().FetchFull(func(reader io.Reader) { if background { doExec(reader) @@ -209,7 +209,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { } }() } else if pipePart { - mv, ok := provider.(*widgets.MessageViewer) + mv, ok := provider.(*app.MessageViewer) if !ok { return fmt.Errorf("can only pipe message part from a message view") } diff --git a/commands/msg/read.go b/commands/msg/read.go index cffd2218..10a874e3 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -6,8 +6,8 @@ import ( "git.sr.ht/~sircmpwn/getopt" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -21,7 +21,7 @@ func (FlagMsg) Aliases() []string { return []string{"flag", "unflag", "read", "unread"} } -func (FlagMsg) Complete(aerc *widgets.Aerc, args []string) []string { +func (FlagMsg) Complete(aerc *app.Aerc, args []string) []string { return nil } @@ -32,7 +32,7 @@ func (FlagMsg) Complete(aerc *widgets.Aerc, args []string) []string { // // If this was called as 'read' or 'unread', it has the same effect as // 'flag' or 'unflag', respectively, but the 'Seen' flag is affected. -func (FlagMsg) Execute(aerc *widgets.Aerc, args []string) error { +func (FlagMsg) Execute(aerc *app.Aerc, args []string) error { // The flag to change var flag models.Flags // User-readable name of the flag to change diff --git a/commands/msg/recall.go b/commands/msg/recall.go index e7579ca1..4a08df29 100644 --- a/commands/msg/recall.go +++ b/commands/msg/recall.go @@ -10,10 +10,10 @@ import ( _ "github.com/emersion/go-message/charset" "github.com/pkg/errors" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/log" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" "git.sr.ht/~sircmpwn/getopt" ) @@ -28,11 +28,11 @@ func (Recall) Aliases() []string { return []string{"recall"} } -func (Recall) Complete(aerc *widgets.Aerc, args []string) []string { +func (Recall) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (Recall) Execute(aerc *widgets.Aerc, args []string) error { +func (Recall) Execute(aerc *app.Aerc, args []string) error { force := false editHeaders := config.Compose.EditHeaders @@ -54,7 +54,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("Usage: recall [-f] [-e|-E]") } - widget := aerc.SelectedTabContent().(widgets.ProvidesMessage) + widget := aerc.SelectedTabContent().(app.ProvidesMessage) acct := widget.SelectedAccount() if acct == nil { return errors.New("No account selected") @@ -74,13 +74,13 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { } log.Debugf("Recalling message <%s>", msgInfo.Envelope.MessageId) - addTab := func(composer *widgets.Composer) { + addTab := func(composer *app.Composer) { subject := msgInfo.Envelope.Subject if subject == "" { subject = "Recalled email" } composer.Tab = aerc.NewTab(composer, subject) - composer.OnClose(func(composer *widgets.Composer) { + composer.OnClose(func(composer *app.Composer) { worker := composer.Worker() uids := []uint32{msgInfo.Uid} @@ -116,7 +116,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { } msg.FetchBodyPart(path, func(reader io.Reader) { - composer, err := widgets.NewComposer(aerc, acct, + composer, err := app.NewComposer(aerc, acct, acct.AccountConfig(), acct.Worker(), editHeaders, "", msgInfo.RFC822Headers, nil, reader) if err != nil { diff --git a/commands/msg/reply.go b/commands/msg/reply.go index b2a61a80..035e6aa3 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -11,6 +11,7 @@ import ( "git.sr.ht/~sircmpwn/getopt" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/commands/account" "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" @@ -19,7 +20,6 @@ import ( "git.sr.ht/~rjarry/aerc/lib/parse" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" "github.com/emersion/go-message/mail" ) @@ -33,11 +33,11 @@ func (reply) Aliases() []string { return []string{"reply"} } -func (reply) Complete(aerc *widgets.Aerc, args []string) []string { +func (reply) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (reply) Execute(aerc *widgets.Aerc, args []string) error { +func (reply) Execute(aerc *app.Aerc, args []string) error { opts, optind, err := getopt.Getopts(args, "acqT:eE") if err != nil { return err @@ -69,7 +69,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { } } - widget := aerc.SelectedTabContent().(widgets.ProvidesMessage) + widget := aerc.SelectedTabContent().(app.ProvidesMessage) acct := widget.SelectedAccount() if acct == nil { @@ -177,9 +177,9 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { RFC822Headers: msg.RFC822Headers, } - mv, _ := aerc.SelectedTabContent().(*widgets.MessageViewer) + mv, _ := aerc.SelectedTabContent().(*app.MessageViewer) addTab := func() error { - composer, err := widgets.NewComposer(aerc, acct, + composer, err := app.NewComposer(aerc, acct, acct.AccountConfig(), acct.Worker(), editHeaders, template, h, &original, nil) if err != nil { @@ -196,7 +196,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { composer.Tab = aerc.NewTab(composer, subject) - composer.OnClose(func(c *widgets.Composer) { + composer.OnClose(func(c *app.Composer) { switch { case c.Sent() && c.Archive() != "": store.Answered([]uint32{msg.Uid}, true, nil) @@ -221,8 +221,8 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { } if crypto.IsEncrypted(msg.BodyStructure) { - provider := aerc.SelectedTabContent().(widgets.ProvidesMessage) - mv, ok := provider.(*widgets.MessageViewer) + provider := aerc.SelectedTabContent().(app.ProvidesMessage) + mv, ok := provider.(*app.MessageViewer) if !ok { return fmt.Errorf("message is encrypted. can only quote reply while message is open") } diff --git a/commands/msg/toggle-thread-context.go b/commands/msg/toggle-thread-context.go index 09c60b85..6f8b7bbb 100644 --- a/commands/msg/toggle-thread-context.go +++ b/commands/msg/toggle-thread-context.go @@ -3,8 +3,8 @@ package msg import ( "errors" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/lib/ui" - "git.sr.ht/~rjarry/aerc/widgets" ) type ToggleThreadContext struct{} @@ -17,11 +17,11 @@ func (ToggleThreadContext) Aliases() []string { return []string{"toggle-thread-context"} } -func (ToggleThreadContext) Complete(aerc *widgets.Aerc, args []string) []string { +func (ToggleThreadContext) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (ToggleThreadContext) Execute(aerc *widgets.Aerc, args []string) error { +func (ToggleThreadContext) Execute(aerc *app.Aerc, args []string) error { if len(args) != 1 { return errors.New("Usage: toggle-entire-thread") } diff --git a/commands/msg/toggle-threads.go b/commands/msg/toggle-threads.go index 9508da50..0b85e510 100644 --- a/commands/msg/toggle-threads.go +++ b/commands/msg/toggle-threads.go @@ -3,9 +3,9 @@ package msg import ( "errors" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/lib/state" "git.sr.ht/~rjarry/aerc/lib/ui" - "git.sr.ht/~rjarry/aerc/widgets" ) type ToggleThreads struct{} @@ -18,11 +18,11 @@ func (ToggleThreads) Aliases() []string { return []string{"toggle-threads"} } -func (ToggleThreads) Complete(aerc *widgets.Aerc, args []string) []string { +func (ToggleThreads) Complete(aerc *app.Aerc, args []string) []string { return nil } -func (ToggleThreads) Execute(aerc *widgets.Aerc, args []string) error { +func (ToggleThreads) Execute(aerc *app.Aerc, args []string) error { if len(args) != 1 { return errors.New("Usage: toggle-threads") } diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go index 505392d4..23029244 100644 --- a/commands/msg/unsubscribe.go +++ b/commands/msg/unsubscribe.go @@ -8,10 +8,10 @@ import ( "strings" "time" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/log" - "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~sircmpwn/getopt" "github.com/emersion/go-message/mail" ) @@ -30,12 +30,12 @@ func (Unsubscribe) Aliases() []string { } // Complete returns a list of completions -func (Unsubscribe) Complete(aerc *widgets.Aerc, args []string) []string { +func (Unsubscribe) Complete(aerc *app.Aerc, args []string) []string { return nil } // Execute runs the Unsubscribe command -func (Unsubscribe) Execute(aerc *widgets.Aerc, args []string) error { +func (Unsubscribe) Execute(aerc *app.Aerc, args []string) error { editHeaders := config.Compose.EditHeaders opts, optind, err := getopt.Getopts(args, "eE") if err != nil { @@ -52,7 +52,7 @@ func (Unsubscribe) Execute(aerc *widgets.Aerc, args []string) error { editHeaders = false } } - widget := aerc.SelectedTabContent().(widgets.ProvidesMessage) + widget := aerc.SelectedTabContent().(app.ProvidesMessage) msg, err := widget.SelectedMessage() if err != nil { return err @@ -97,14 +97,14 @@ func (Unsubscribe) Execute(aerc *widgets.Aerc, args []string) error { options[i] = method.Scheme } - dialog := widgets.NewSelectorDialog( + dialog := app.NewSelectorDialog( title, "Press <Enter> to confirm or <ESC> to cancel", options, 0, aerc.SelectedAccountUiConfig(), func(option string, err error) { aerc.CloseDialog() if err != nil { - if errors.Is(err, widgets.ErrNoOptionSelected) { + if errors.Is(err, app.ErrNoOptionSelected) { aerc.PushStatus("Unsubscribe: "+err.Error(), 5*time.Second) } else { @@ -148,8 +148,8 @@ func parseUnsubscribeMethods(header string) (methods []*url.URL) { } } -func unsubscribeMailto(aerc *widgets.Aerc, u *url.URL, editHeaders bool) error { - widget := aerc.SelectedTabContent().(widgets.ProvidesMessage) +func unsubscribeMailto(aerc *app.Aerc, u *url.URL, editHeaders bool) error { + widget := aerc.SelectedTabContent().(app.ProvidesMessage) acct := widget.SelectedAccount() if acct == nil { return errors.New("No account selected") @@ -161,7 +161,7 @@ func unsubscribeMailto(aerc *widgets.Aerc, u *url.URL, editHeaders bool) error { h.SetAddressList("to", to) } - composer, err := widgets.NewComposer( + composer, err := app.NewComposer( aerc, acct, acct.AccountConfig(), @@ -180,8 +180,8 @@ func unsubscribeMailto(aerc *widgets.Aerc, u *url.URL, editHeaders bool) error { return nil } -func unsubscribeHTTP(aerc *widgets.Aerc, u *url.URL) error { - confirm := widgets.NewSelectorDialog( +func unsubscribeHTTP(aerc *app.Aerc, u *url.URL) error { + confirm := app.NewSelectorDialog( "Do you want to open this link?", u.String(), []string{"No", "Yes"}, 0, aerc.SelectedAccountUiConfig(), diff --git a/commands/msg/utils.go b/commands/msg/utils.go index 8210cae1..423be37d 100644 --- a/commands/msg/utils.go +++ b/commands/msg/utils.go @@ -4,19 +4,19 @@ import ( "errors" "time" + "git.sr.ht/~rjarry/aerc/app" "git.sr.ht/~rjarry/aerc/commands" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/models" - "git.sr.ht/~rjarry/aerc/widgets" ) type helper struct { - msgProvider widgets.ProvidesMessages + msgProvider app.ProvidesMessages statusInfo func(string) } -func newHelper(aerc *widgets.Aerc) *helper { - msgProvider, ok := aerc.SelectedTabContent().(widgets.ProvidesMessages) +func newHelper(aerc *app.Aerc) *helper { + msgProvider, ok := aerc.SelectedTabContent().(app.ProvidesMessages) if !ok { msgProvider = aerc.SelectedAccount() } @@ -40,7 +40,7 @@ func (h *helper) store() (*lib.MessageStore, error) { return store, nil } -func (h *helper) account() (*widgets.AccountView, error) { +func (h *helper) account() (*app.AccountView, error) { acct := h.msgProvider.SelectedAccount() if acct == nil { return nil, errors.New("No account selected") |