From 74bba6745d2bf1120d143a9898c8a7204d9d20e9 Mon Sep 17 00:00:00 2001 From: Bence Ferdinandy Date: Thu, 30 May 2024 11:30:16 +0200 Subject: hooks: add AERC_FOLDER_ROLE to hooks with AERC_FOLDER It's logical to pass this information as well, when we pass a folder name. Changelog-added: Added `AERC_FOLDER_ROLE` to hooks that have `AERC_FOLDER`. Signed-off-by: Bence Ferdinandy Acked-by: Robin Jarry --- lib/hooks/flag-changed.go | 2 ++ lib/hooks/mail-added.go | 2 ++ lib/hooks/mail-deleted.go | 2 ++ lib/hooks/mail-received.go | 2 ++ 4 files changed, 8 insertions(+) (limited to 'lib/hooks') diff --git a/lib/hooks/flag-changed.go b/lib/hooks/flag-changed.go index aaeff014..e70b67c0 100644 --- a/lib/hooks/flag-changed.go +++ b/lib/hooks/flag-changed.go @@ -9,6 +9,7 @@ import ( type FlagChanged struct { Account string Folder string + Role string FlagName string } @@ -20,6 +21,7 @@ func (m *FlagChanged) Env() []string { env := []string{ fmt.Sprintf("AERC_ACCOUNT=%s", m.Account), fmt.Sprintf("AERC_FOLDER=%s", m.Folder), + fmt.Sprintf("AERC_FOLDER_ROLE=%s", m.Role), fmt.Sprintf("AERC_FLAG=%s", m.FlagName), } diff --git a/lib/hooks/mail-added.go b/lib/hooks/mail-added.go index f146d010..0fa72747 100644 --- a/lib/hooks/mail-added.go +++ b/lib/hooks/mail-added.go @@ -9,6 +9,7 @@ import ( type MailAdded struct { Account string Folder string + Role string } func (m *MailAdded) Cmd() string { @@ -19,5 +20,6 @@ func (m *MailAdded) Env() []string { return []string{ fmt.Sprintf("AERC_ACCOUNT=%s", m.Account), fmt.Sprintf("AERC_FOLDER=%s", m.Folder), + fmt.Sprintf("AERC_FOLDER_ROLE=%s", m.Role), } } diff --git a/lib/hooks/mail-deleted.go b/lib/hooks/mail-deleted.go index e9f13105..ca190ee0 100644 --- a/lib/hooks/mail-deleted.go +++ b/lib/hooks/mail-deleted.go @@ -9,6 +9,7 @@ import ( type MailDeleted struct { Account string Folder string + Role string } func (m *MailDeleted) Cmd() string { @@ -19,5 +20,6 @@ func (m *MailDeleted) Env() []string { return []string{ fmt.Sprintf("AERC_ACCOUNT=%s", m.Account), fmt.Sprintf("AERC_FOLDER=%s", m.Folder), + fmt.Sprintf("AERC_FOLDER_ROLE=%s", m.Role), } } diff --git a/lib/hooks/mail-received.go b/lib/hooks/mail-received.go index 99d3ceef..67457883 100644 --- a/lib/hooks/mail-received.go +++ b/lib/hooks/mail-received.go @@ -10,6 +10,7 @@ import ( type MailReceived struct { Account string Folder string + Role string MsgInfo *models.MessageInfo } @@ -26,5 +27,6 @@ func (m *MailReceived) Env() []string { fmt.Sprintf("AERC_FROM_ADDRESS=%s", from.Address), fmt.Sprintf("AERC_SUBJECT=%s", m.MsgInfo.Envelope.Subject), fmt.Sprintf("AERC_MESSAGE_ID=%s", m.MsgInfo.Envelope.MessageId), + fmt.Sprintf("AERC_FOLDER_ROLE=%s", m.Role), } } -- cgit