2512c0403f
Implement a statusline state for each account. Keep the ex line and the push notifications global. Add account name prefix to push notifications. Prefix status line with account name when multiple accounts are available. Use account-specific status line for each tab where an account is defined. Handle threading, filter/search, viewer passthrough and connection status. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
37 lines
675 B
Go
37 lines
675 B
Go
package account
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"git.sr.ht/~rjarry/aerc/lib/statusline"
|
|
"git.sr.ht/~rjarry/aerc/widgets"
|
|
)
|
|
|
|
type Clear struct{}
|
|
|
|
func init() {
|
|
register(Clear{})
|
|
}
|
|
|
|
func (Clear) Aliases() []string {
|
|
return []string{"clear"}
|
|
}
|
|
|
|
func (Clear) Complete(aerc *widgets.Aerc, args []string) []string {
|
|
return nil
|
|
}
|
|
|
|
func (Clear) Execute(aerc *widgets.Aerc, args []string) error {
|
|
acct := aerc.SelectedAccount()
|
|
if acct == nil {
|
|
return errors.New("No account selected")
|
|
}
|
|
store := acct.Store()
|
|
if store == nil {
|
|
return errors.New("Cannot perform action. Messages still loading")
|
|
}
|
|
store.ApplyClear()
|
|
acct.SetStatus(statusline.SearchFilterClear())
|
|
|
|
return nil
|
|
}
|