aboutsummaryrefslogtreecommitdiffstats
path: root/commands/account
diff options
context:
space:
mode:
Diffstat (limited to 'commands/account')
-rw-r--r--commands/account/cf.go8
-rw-r--r--commands/account/check-mail.go6
-rw-r--r--commands/account/clear.go6
-rw-r--r--commands/account/compose.go10
-rw-r--r--commands/account/connection.go6
-rw-r--r--commands/account/expand-folder.go6
-rw-r--r--commands/account/export-mbox.go20
-rw-r--r--commands/account/import-mbox.go23
-rw-r--r--commands/account/mkdir.go14
-rw-r--r--commands/account/next-folder.go6
-rw-r--r--commands/account/next-result.go6
-rw-r--r--commands/account/next.go6
-rw-r--r--commands/account/recover.go14
-rw-r--r--commands/account/rmdir.go12
-rw-r--r--commands/account/search.go13
-rw-r--r--commands/account/select.go6
-rw-r--r--commands/account/sort.go8
-rw-r--r--commands/account/split.go12
-rw-r--r--commands/account/view.go14
19 files changed, 97 insertions, 99 deletions
diff --git a/commands/account/cf.go b/commands/account/cf.go
index 38841474..cd93ed29 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -22,15 +22,15 @@ func (ChangeFolder) Aliases() []string {
return []string{"cf"}
}
-func (ChangeFolder) Complete(aerc *app.Aerc, args []string) []string {
- return commands.GetFolders(aerc, args)
+func (ChangeFolder) Complete(args []string) []string {
+ return commands.GetFolders(args)
}
-func (ChangeFolder) Execute(aerc *app.Aerc, args []string) error {
+func (ChangeFolder) Execute(args []string) error {
if len(args) == 1 {
return errors.New("Usage: cf <folder>")
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/check-mail.go b/commands/account/check-mail.go
index 2b6a06f9..a8d80a66 100644
--- a/commands/account/check-mail.go
+++ b/commands/account/check-mail.go
@@ -16,12 +16,12 @@ func (CheckMail) Aliases() []string {
return []string{"check-mail"}
}
-func (CheckMail) Complete(aerc *app.Aerc, args []string) []string {
+func (CheckMail) Complete(args []string) []string {
return nil
}
-func (CheckMail) Execute(aerc *app.Aerc, args []string) error {
- acct := aerc.SelectedAccount()
+func (CheckMail) Execute(args []string) error {
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/clear.go b/commands/account/clear.go
index 547c26c4..b67454dd 100644
--- a/commands/account/clear.go
+++ b/commands/account/clear.go
@@ -18,12 +18,12 @@ func (Clear) Aliases() []string {
return []string{"clear"}
}
-func (Clear) Complete(aerc *app.Aerc, args []string) []string {
+func (Clear) Complete(args []string) []string {
return nil
}
-func (Clear) Execute(aerc *app.Aerc, args []string) error {
- acct := aerc.SelectedAccount()
+func (Clear) Execute(args []string) error {
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/compose.go b/commands/account/compose.go
index e2812251..56079868 100644
--- a/commands/account/compose.go
+++ b/commands/account/compose.go
@@ -25,16 +25,16 @@ func (Compose) Aliases() []string {
return []string{"compose"}
}
-func (Compose) Complete(aerc *app.Aerc, args []string) []string {
+func (Compose) Complete(args []string) []string {
return nil
}
-func (Compose) Execute(aerc *app.Aerc, args []string) error {
+func (Compose) Execute(args []string) error {
body, template, editHeaders, err := buildBody(args)
if err != nil {
return err
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
@@ -50,13 +50,13 @@ func (Compose) Execute(aerc *app.Aerc, args []string) error {
}
headers := mail.HeaderFromMap(msg.Header)
- composer, err := app.NewComposer(aerc, acct,
+ composer, err := app.NewComposer(acct,
acct.AccountConfig(), acct.Worker(), editHeaders,
template, &headers, nil, msg.Body)
if err != nil {
return err
}
- composer.Tab = aerc.NewTab(composer, "New email")
+ composer.Tab = app.NewTab(composer, "New email")
return nil
}
diff --git a/commands/account/connection.go b/commands/account/connection.go
index 2704d9bb..3b30dbda 100644
--- a/commands/account/connection.go
+++ b/commands/account/connection.go
@@ -18,12 +18,12 @@ func (Connection) Aliases() []string {
return []string{"connect", "disconnect"}
}
-func (Connection) Complete(aerc *app.Aerc, args []string) []string {
+func (Connection) Complete(args []string) []string {
return nil
}
-func (Connection) Execute(aerc *app.Aerc, args []string) error {
- acct := aerc.SelectedAccount()
+func (Connection) Execute(args []string) error {
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/expand-folder.go b/commands/account/expand-folder.go
index 8a7a8e93..29203adc 100644
--- a/commands/account/expand-folder.go
+++ b/commands/account/expand-folder.go
@@ -17,15 +17,15 @@ func (ExpandCollapseFolder) Aliases() []string {
return []string{"expand-folder", "collapse-folder"}
}
-func (ExpandCollapseFolder) Complete(aerc *app.Aerc, args []string) []string {
+func (ExpandCollapseFolder) Complete(args []string) []string {
return nil
}
-func (ExpandCollapseFolder) Execute(aerc *app.Aerc, args []string) error {
+func (ExpandCollapseFolder) Execute(args []string) error {
if len(args) > 1 {
return expandCollapseFolderUsage(args[0])
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/export-mbox.go b/commands/account/export-mbox.go
index c227bdf9..e9a663c5 100644
--- a/commands/account/export-mbox.go
+++ b/commands/account/export-mbox.go
@@ -25,17 +25,17 @@ func (ExportMbox) Aliases() []string {
return []string{"export-mbox"}
}
-func (ExportMbox) Complete(aerc *app.Aerc, args []string) []string {
+func (ExportMbox) Complete(args []string) []string {
return commands.CompletePath(filepath.Join(args...))
}
-func (ExportMbox) Execute(aerc *app.Aerc, args []string) error {
+func (ExportMbox) Execute(args []string) error {
if len(args) != 2 {
return exportFolderUsage(args[0])
}
filename := args[1]
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
@@ -53,15 +53,15 @@ func (ExportMbox) Execute(aerc *app.Aerc, args []string) error {
}
}
- aerc.PushStatus("Exporting to "+filename, 10*time.Second)
+ app.PushStatus("Exporting to "+filename, 10*time.Second)
// uids of messages to export
var uids []uint32
// check if something is marked - we export that then
- msgProvider, ok := aerc.SelectedTabContent().(app.ProvidesMessages)
+ msgProvider, ok := app.SelectedTabContent().(app.ProvidesMessages)
if !ok {
- msgProvider = aerc.SelectedAccount()
+ msgProvider = app.SelectedAccount()
}
if msgProvider != nil {
marked, err := msgProvider.MarkedMessages()
@@ -75,7 +75,7 @@ func (ExportMbox) Execute(aerc *app.Aerc, args []string) error {
file, err := os.Create(filename)
if err != nil {
log.Errorf("failed to create file: %v", err)
- aerc.PushError(err.Error())
+ app.PushError(err.Error())
return
}
defer file.Close()
@@ -99,7 +99,7 @@ func (ExportMbox) Execute(aerc *app.Aerc, args []string) error {
if retries > 10 {
errorMsg := fmt.Sprintf("too many retries: %d; stopping export", retries)
log.Errorf(errorMsg)
- aerc.PushError(args[0] + " " + errorMsg)
+ app.PushError(args[0] + " " + errorMsg)
break
}
sleeping := time.Duration(retries * 1e9 * 2)
@@ -116,7 +116,7 @@ func (ExportMbox) Execute(aerc *app.Aerc, args []string) error {
done <- true
case *types.Error:
log.Errorf("failed to fetch message: %v", msg.Error)
- aerc.PushError(args[0] + " error encountered: " + msg.Error.Error())
+ app.PushError(args[0] + " error encountered: " + msg.Error.Error())
done <- false
case *types.FullMessage:
mu.Lock()
@@ -140,7 +140,7 @@ func (ExportMbox) Execute(aerc *app.Aerc, args []string) error {
retries++
}
statusInfo := fmt.Sprintf("Exported %d of %d messages to %s.", ctr, total, filename)
- aerc.PushStatus(statusInfo, 10*time.Second)
+ app.PushStatus(statusInfo, 10*time.Second)
log.Debugf(statusInfo)
}()
diff --git a/commands/account/import-mbox.go b/commands/account/import-mbox.go
index 2a441737..4ede8c26 100644
--- a/commands/account/import-mbox.go
+++ b/commands/account/import-mbox.go
@@ -28,17 +28,17 @@ func (ImportMbox) Aliases() []string {
return []string{"import-mbox"}
}
-func (ImportMbox) Complete(aerc *app.Aerc, args []string) []string {
+func (ImportMbox) Complete(args []string) []string {
return commands.CompletePath(filepath.Join(args...))
}
-func (ImportMbox) Execute(aerc *app.Aerc, args []string) error {
+func (ImportMbox) Execute(args []string) error {
if len(args) != 2 {
return importFolderUsage(args[0])
}
filename := args[1]
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
@@ -55,18 +55,18 @@ func (ImportMbox) Execute(aerc *app.Aerc, args []string) error {
importFolder := func() {
defer log.PanicHandler()
statusInfo := fmt.Sprintln("Importing", filename, "to folder", folder)
- aerc.PushStatus(statusInfo, 10*time.Second)
+ app.PushStatus(statusInfo, 10*time.Second)
log.Debugf(statusInfo)
f, err := os.Open(filename)
if err != nil {
- aerc.PushError(err.Error())
+ app.PushError(err.Error())
return
}
defer f.Close()
messages, err := mboxer.Read(f)
if err != nil {
- aerc.PushError(err.Error())
+ app.PushError(err.Error())
return
}
worker := acct.Worker()
@@ -94,7 +94,7 @@ func (ImportMbox) Execute(aerc *app.Aerc, args []string) error {
case *types.Unsupported:
errMsg := fmt.Sprintf("%s: AppendMessage is unsupported", args[0])
log.Errorf(errMsg)
- aerc.PushError(errMsg)
+ app.PushError(errMsg)
return
case *types.Error:
log.Errorf("AppendMessage failed: %v", msg.Error)
@@ -125,23 +125,22 @@ func (ImportMbox) Execute(aerc *app.Aerc, args []string) error {
}
infoStr := fmt.Sprintf("%s: imported %d of %d successfully.", args[0], appended, len(messages))
log.Debugf(infoStr)
- aerc.PushSuccess(infoStr)
+ app.PushSuccess(infoStr)
}
if len(store.Uids()) > 0 {
confirm := app.NewSelectorDialog(
"Selected directory is not empty",
fmt.Sprintf("Import mbox file to %s anyways?", folder),
- []string{"No", "Yes"}, 0, aerc.SelectedAccountUiConfig(),
+ []string{"No", "Yes"}, 0, app.SelectedAccountUiConfig(),
func(option string, err error) {
- aerc.CloseDialog()
- aerc.Invalidate()
+ app.CloseDialog()
if option == "Yes" {
go importFolder()
}
},
)
- aerc.AddDialog(confirm)
+ app.AddDialog(confirm)
} else {
go importFolder()
}
diff --git a/commands/account/mkdir.go b/commands/account/mkdir.go
index 79e0a4fa..7a1f7b9e 100644
--- a/commands/account/mkdir.go
+++ b/commands/account/mkdir.go
@@ -19,13 +19,13 @@ func (MakeDir) Aliases() []string {
return []string{"mkdir"}
}
-func (MakeDir) Complete(aerc *app.Aerc, args []string) []string {
+func (MakeDir) Complete(args []string) []string {
if len(args) == 0 {
return nil
}
name := strings.Join(args, " ")
- list := aerc.SelectedAccount().Directories().List()
+ list := app.SelectedAccount().Directories().List()
inboxes := make([]string, len(list))
copy(inboxes, list)
@@ -36,16 +36,16 @@ func (MakeDir) Complete(aerc *app.Aerc, args []string) []string {
inboxes = append(inboxes[:i], inboxes[i+1:]...)
continue
}
- inboxes[i] += aerc.SelectedAccount().Worker().PathSeparator()
+ inboxes[i] += app.SelectedAccount().Worker().PathSeparator()
}
return inboxes
}
-func (MakeDir) Execute(aerc *app.Aerc, args []string) error {
+func (MakeDir) Execute(args []string) error {
if len(args) == 0 {
return errors.New("Usage: :mkdir <name>")
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
@@ -55,10 +55,10 @@ func (MakeDir) Execute(aerc *app.Aerc, args []string) error {
}, func(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.Done:
- aerc.PushStatus("Directory created.", 10*time.Second)
+ app.PushStatus("Directory created.", 10*time.Second)
acct.Directories().Select(name)
case *types.Error:
- aerc.PushError(msg.Error.Error())
+ app.PushError(msg.Error.Error())
}
})
return nil
diff --git a/commands/account/next-folder.go b/commands/account/next-folder.go
index b0657ff1..2b23e6da 100644
--- a/commands/account/next-folder.go
+++ b/commands/account/next-folder.go
@@ -18,11 +18,11 @@ func (NextPrevFolder) Aliases() []string {
return []string{"next-folder", "prev-folder"}
}
-func (NextPrevFolder) Complete(aerc *app.Aerc, args []string) []string {
+func (NextPrevFolder) Complete(args []string) []string {
return nil
}
-func (NextPrevFolder) Execute(aerc *app.Aerc, args []string) error {
+func (NextPrevFolder) Execute(args []string) error {
if len(args) > 2 {
return nextPrevFolderUsage(args[0])
}
@@ -36,7 +36,7 @@ func (NextPrevFolder) Execute(aerc *app.Aerc, args []string) error {
return nextPrevFolderUsage(args[0])
}
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/next-result.go b/commands/account/next-result.go
index 06478f0c..ef4078da 100644
--- a/commands/account/next-result.go
+++ b/commands/account/next-result.go
@@ -18,15 +18,15 @@ func (NextPrevResult) Aliases() []string {
return []string{"next-result", "prev-result"}
}
-func (NextPrevResult) Complete(aerc *app.Aerc, args []string) []string {
+func (NextPrevResult) Complete(args []string) []string {
return nil
}
-func (NextPrevResult) Execute(aerc *app.Aerc, args []string) error {
+func (NextPrevResult) Execute(args []string) error {
if len(args) > 1 {
return nextPrevResultUsage(args[0])
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/next.go b/commands/account/next.go
index 224534b9..fff36bd1 100644
--- a/commands/account/next.go
+++ b/commands/account/next.go
@@ -20,16 +20,16 @@ func (NextPrevMsg) Aliases() []string {
return []string{"next", "next-message", "prev", "prev-message"}
}
-func (NextPrevMsg) Complete(aerc *app.Aerc, args []string) []string {
+func (NextPrevMsg) Complete(args []string) []string {
return nil
}
-func (NextPrevMsg) Execute(aerc *app.Aerc, args []string) error {
+func (NextPrevMsg) Execute(args []string) error {
n, pct, err := ParseNextPrevMessage(args)
if err != nil {
return err
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/recover.go b/commands/account/recover.go
index 1bb1aceb..e0d1c6eb 100644
--- a/commands/account/recover.go
+++ b/commands/account/recover.go
@@ -27,7 +27,7 @@ func (Recover) Options() string {
return "feE"
}
-func (r Recover) Complete(aerc *app.Aerc, args []string) []string {
+func (r Recover) Complete(args []string) []string {
// file name of temp file is hard-coded in the NewComposer() function
files, err := filepath.Glob(
filepath.Join(os.TempDir(), "aerc-compose-*.eml"),
@@ -35,13 +35,13 @@ func (r Recover) Complete(aerc *app.Aerc, args []string) []string {
if err != nil {
return nil
}
- return commands.CompletionFromList(aerc, files,
+ return commands.CompletionFromList(files,
commands.Operands(args, r.Options()))
}
-func (r Recover) Execute(aerc *app.Aerc, args []string) error {
+func (r Recover) Execute(args []string) error {
// Complete() expects to be passed only the arguments, not including the command name
- if len(Recover{}.Complete(aerc, args[1:])) == 0 {
+ if len(Recover{}.Complete(args[1:])) == 0 {
return errors.New("No messages to recover.")
}
@@ -67,7 +67,7 @@ func (r Recover) Execute(aerc *app.Aerc, args []string) error {
return errors.New("Usage: recover [-f] [-E|-e] <file>")
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
@@ -89,13 +89,13 @@ func (r Recover) Execute(aerc *app.Aerc, args []string) error {
return err
}
- composer, err := app.NewComposer(aerc, acct,
+ composer, err := app.NewComposer(acct,
acct.AccountConfig(), acct.Worker(), editHeaders,
"", nil, nil, bytes.NewReader(data))
if err != nil {
return err
}
- composer.Tab = aerc.NewTab(composer, "Recovered")
+ composer.Tab = app.NewTab(composer, "Recovered")
// remove file if force flag is set
if force {
diff --git a/commands/account/rmdir.go b/commands/account/rmdir.go
index eca8b59f..3b109a67 100644
--- a/commands/account/rmdir.go
+++ b/commands/account/rmdir.go
@@ -20,12 +20,12 @@ func (RemoveDir) Aliases() []string {
return []string{"rmdir"}
}
-func (RemoveDir) Complete(aerc *app.Aerc, args []string) []string {
+func (RemoveDir) Complete(args []string) []string {
return nil
}
-func (RemoveDir) Execute(aerc *app.Aerc, args []string) error {
- acct := aerc.SelectedAccount()
+func (RemoveDir) Execute(args []string) error {
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
@@ -84,11 +84,11 @@ func (RemoveDir) Execute(aerc *app.Aerc, args []string) error {
}, func(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.Done:
- aerc.PushStatus("Directory removed.", 10*time.Second)
+ app.PushStatus("Directory removed.", 10*time.Second)
case *types.Error:
- aerc.PushError(msg.Error.Error())
+ app.PushError(msg.Error.Error())
case *types.Unsupported:
- aerc.PushError(":rmdir is not supported by the backend.")
+ app.PushError(":rmdir is not supported by the backend.")
}
})
diff --git a/commands/account/search.go b/commands/account/search.go
index 04f7ddc3..51bd3042 100644
--- a/commands/account/search.go
+++ b/commands/account/search.go
@@ -27,7 +27,6 @@ func (SearchFilter) Aliases() []string {
}
func (s SearchFilter) CompleteOption(
- aerc *app.Aerc,
r rune,
search string,
) []string {
@@ -36,20 +35,20 @@ func (s SearchFilter) CompleteOption(
case 'x', 'X':
valid = commands.GetFlagList()
case 't', 'f', 'c':
- valid = commands.GetAddress(aerc, search)
+ valid = commands.GetAddress(search)
case 'd':
valid = commands.GetDateList()
default:
}
- return commands.CompletionFromList(aerc, valid, []string{search})
+ return commands.CompletionFromList(valid, []string{search})
}
-func (SearchFilter) Complete(aerc *app.Aerc, args []string) []string {
+func (SearchFilter) Complete(args []string) []string {
return nil
}
-func (SearchFilter) Execute(aerc *app.Aerc, args []string) error {
- acct := aerc.SelectedAccount()
+func (SearchFilter) Execute(args []string) error {
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
@@ -60,7 +59,7 @@ func (SearchFilter) Execute(aerc *app.Aerc, args []string) error {
if args[0] == "filter" {
if len(args[1:]) == 0 {
- return Clear{}.Execute(aerc, []string{"clear"})
+ return Clear{}.Execute([]string{"clear"})
}
acct.SetStatus(state.FilterActivity("Filtering..."), state.Search(""))
store.SetFilter(args[1:])
diff --git a/commands/account/select.go b/commands/account/select.go
index aeb584f4..aea17e0e 100644
--- a/commands/account/select.go
+++ b/commands/account/select.go
@@ -17,11 +17,11 @@ func (SelectMessage) Aliases() []string {
return []string{"select", "select-message"}
}
-func (SelectMessage) Complete(aerc *app.Aerc, args []string) []string {
+func (SelectMessage) Complete(args []string) []string {
return nil
}
-func (SelectMessage) Execute(aerc *app.Aerc, args []string) error {
+func (SelectMessage) Execute(args []string) error {
if len(args) != 2 {
return errors.New("Usage: :select-message <n>")
}
@@ -35,7 +35,7 @@ func (SelectMessage) Execute(aerc *app.Aerc, args []string) error {
return errors.New("Usage: :select-message <n>")
}
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
diff --git a/commands/account/sort.go b/commands/account/sort.go
index 8624ff12..a7edd552 100644
--- a/commands/account/sort.go
+++ b/commands/account/sort.go
@@ -21,7 +21,7 @@ func (Sort) Aliases() []string {
return []string{"sort"}
}
-func (Sort) Complete(aerc *app.Aerc, args []string) []string {
+func (Sort) Complete(args []string) []string {
supportedCriteria := []string{
"arrival",
"cc",
@@ -58,12 +58,12 @@ func (Sort) Complete(aerc *app.Aerc, args []string) []string {
}
// the last item is not complete
completions = commands.FilterList(supportedCriteria, last, currentPrefix,
- aerc.SelectedAccountUiConfig().FuzzyComplete)
+ app.SelectedAccountUiConfig().FuzzyComplete)
return completions
}
-func (Sort) Execute(aerc *app.Aerc, args []string) error {
- acct := aerc.SelectedAccount()
+func (Sort) Execute(args []string) error {
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected.")
}
diff --git a/commands/account/split.go b/commands/account/split.go
index 82870d60..ddc79e2f 100644
--- a/commands/account/split.go
+++ b/commands/account/split.go
@@ -18,28 +18,28 @@ func (Split) Aliases() []string {
return []string{"split", "vsplit"}
}
-func (Split) Complete(aerc *app.Aerc, args []string) []string {
+func (Split) Complete(args []string) []string {
return nil
}
-func (Split) Execute(aerc *app.Aerc, args []string) error {
+func (Split) Execute(args []string) error {
if len(args) > 2 {
return errors.New("Usage: [v]split n")
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
- store := aerc.SelectedAccount().Store()
+ store := app.SelectedAccount().Store()
if store == nil {
return errors.New("Cannot perform action. Messages still loading")
}
n := 0
if acct.SplitSize() == 0 {
if args[0] == "split" {
- n = aerc.SelectedAccount().Messages().Height() / 4
+ n = app.SelectedAccount().Messages().Height() / 4
} else {
- n = aerc.SelectedAccount().Messages().Width() / 2
+ n = app.SelectedAccount().Messages().Width() / 2
}
}
diff --git a/commands/account/view.go b/commands/account/view.go
index cbf2ce3f..8d5bc6ed 100644
--- a/commands/account/view.go
+++ b/commands/account/view.go
@@ -18,11 +18,11 @@ func (ViewMessage) Aliases() []string {
return []string{"view-message", "view"}
}
-func (ViewMessage) Complete(aerc *app.Aerc, args []string) []string {
+func (ViewMessage) Complete(args []string) []string {
return nil
}
-func (ViewMessage) Execute(aerc *app.Aerc, args []string) error {
+func (ViewMessage) Execute(args []string) error {
peek := false
opts, optind, err := getopt.Getopts(args, "p")
if err != nil {
@@ -38,7 +38,7 @@ func (ViewMessage) Execute(aerc *app.Aerc, args []string) error {
if len(args) != optind {
return errors.New("Usage: view-message [-p]")
}
- acct := aerc.SelectedAccount()
+ acct := app.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
@@ -55,18 +55,18 @@ func (ViewMessage) Execute(aerc *app.Aerc, args []string) error {
return nil
}
if msg.Error != nil {
- aerc.PushError(msg.Error.Error())
+ app.PushError(msg.Error.Error())
return nil
}
lib.NewMessageStoreView(msg, !peek && acct.UiConfig().AutoMarkRead,
- store, aerc.Crypto, aerc.DecryptKeys,
+ store, app.CryptoProvider(), app.DecryptKeys,
func(view lib.MessageView, err error) {
if err != nil {
- aerc.PushError(err.Error())
+ app.PushError(err.Error())
return
}
viewer := app.NewMessageViewer(acct, view)
- aerc.NewTab(viewer, msg.Envelope.Subject)
+ app.NewTab(viewer, msg.Envelope.Subject)
})
return nil
}