summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/aerc.go4
-rw-r--r--widgets/msgviewer.go19
2 files changed, 23 insertions, 0 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 3c6566d..5b1b151 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -243,6 +243,10 @@ func (aerc *Aerc) PushStatus(text string, expiry time.Duration) *StatusMessage {
 	return aerc.statusline.Push(text, expiry)
 }
 
+func (aerc *Aerc) PushError(text string) {
+	aerc.PushStatus(text, 10*time.Second).Color(tcell.ColorDefault, tcell.ColorRed)
+}
+
 func (aerc *Aerc) focus(item libui.Interactive) {
 	if aerc.focused == item {
 		return
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index e0fe6aa..d31e051 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -199,6 +199,18 @@ func (mv *MessageViewer) OnInvalidate(fn func(d ui.Drawable)) {
 	})
 }
 
+func (mv *MessageViewer) CurrentPart() *PartInfo {
+	switcher := mv.switcher
+	part := switcher.parts[switcher.selected]
+
+	return &PartInfo{
+		Index: part.index,
+		Msg:   part.msg,
+		Part:  part.part,
+		Store: part.store,
+	}
+}
+
 func (mv *MessageViewer) PreviousPart() {
 	switcher := mv.switcher
 	for {
@@ -291,6 +303,13 @@ 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, index []int) (*PartViewer, error) {