From 363aab5cc19135599cae93f6c9c7abcd23c111c9 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 5 Jul 2019 12:21:12 -0400 Subject: Make :pipe command more generic --- widgets/account.go | 8 ++++++-- widgets/msgviewer.go | 9 +-------- widgets/providesmessage.go | 12 +++++++++++- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'widgets') diff --git a/widgets/account.go b/widgets/account.go index 824f958..0948c5c 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -165,12 +165,16 @@ func (acct *AccountView) Store() *lib.MessageStore { return acct.msglist.Store() } +func (acct *AccountView) SelectedAccount() *AccountView { + return acct +} + func (acct *AccountView) SelectedMessage() *types.MessageInfo { return acct.msglist.Selected() } -func (acct *AccountView) SelectedAccount() *AccountView { - return acct +func (acct *AccountView) SelectedMessagePart() *PartInfo { + return nil } func (acct *AccountView) onMessage(msg types.WorkerMessage) { diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 10c2182..b0ae79e 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -227,7 +227,7 @@ func (mv *MessageViewer) ToggleHeaders() { switcher.Invalidate() } -func (mv *MessageViewer) CurrentPart() *PartInfo { +func (mv *MessageViewer) SelectedMessagePart() *PartInfo { switcher := mv.switcher part := switcher.parts[switcher.selected] @@ -332,13 +332,6 @@ type PartViewer struct { term *Terminal } -type PartInfo struct { - Index []int - Msg *types.MessageInfo - Part *imap.BodyStructure - Store *lib.MessageStore -} - func NewPartViewer(conf *config.AercConfig, store *lib.MessageStore, msg *types.MessageInfo, part *imap.BodyStructure, showHeaders bool, diff --git a/widgets/providesmessage.go b/widgets/providesmessage.go index 7be8e7e..4b71637 100644 --- a/widgets/providesmessage.go +++ b/widgets/providesmessage.go @@ -1,14 +1,24 @@ package widgets import ( + "github.com/emersion/go-imap" + "git.sr.ht/~sircmpwn/aerc/lib" "git.sr.ht/~sircmpwn/aerc/lib/ui" "git.sr.ht/~sircmpwn/aerc/worker/types" ) +type PartInfo struct { + Index []int + Msg *types.MessageInfo + Part *imap.BodyStructure + Store *lib.MessageStore +} + type ProvidesMessage interface { ui.Drawable Store() *lib.MessageStore - SelectedMessage() *types.MessageInfo SelectedAccount() *AccountView + SelectedMessage() *types.MessageInfo + SelectedMessagePart() *PartInfo } -- cgit 1.4.1-2-gfad0