diff options
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r-- | widgets/aerc.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go index 7ba1ea4e..656b25de 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -375,6 +375,21 @@ func (aerc *Aerc) SelectedAccount() *AccountView { return aerc.account(aerc.SelectedTabContent()) } +func (aerc *Aerc) Account(name string) (*AccountView, error) { + if acct, ok := aerc.accounts[name]; ok { + return acct, nil + } + return nil, fmt.Errorf("account <%s> not found", name) +} + +func (aerc *Aerc) AccountNames() []string { + results := make([]string, 0) + for name := range aerc.accounts { + results = append(results, name) + } + return results +} + func (aerc *Aerc) account(d ui.Drawable) *AccountView { switch tab := d.(type) { case *AccountView: |