msgviewer: implement ProvidesMessages interface

This commit is contained in:
Reto Brunner 2019-12-18 06:33:58 +01:00 committed by Drew DeVault
parent 98418764b6
commit 3e535f49b3

View file

@ -25,6 +25,8 @@ import (
var ansi = regexp.MustCompile("^\x1B\\[[0-?]*[ -/]*[@-~]") var ansi = regexp.MustCompile("^\x1B\\[[0-?]*[ -/]*[@-~]")
var _ ProvidesMessages = (*MessageViewer)(nil)
type MessageViewer struct { type MessageViewer struct {
ui.Invalidatable ui.Invalidatable
acct *AccountView acct *AccountView
@ -232,6 +234,11 @@ func (mv *MessageViewer) SelectedMessage() (*models.MessageInfo, error) {
return mv.msg, nil return mv.msg, nil
} }
func (mv *MessageViewer) MarkedMessages() ([]*models.MessageInfo, error) {
store := mv.Store()
return msgInfoFromUids(store, store.Marked())
}
func (mv *MessageViewer) ToggleHeaders() { func (mv *MessageViewer) ToggleHeaders() {
switcher := mv.switcher switcher := mv.switcher
mv.conf.Viewer.ShowHeaders = !mv.conf.Viewer.ShowHeaders mv.conf.Viewer.ShowHeaders = !mv.conf.Viewer.ShowHeaders