From 31b50f24d51fd429f30e20fb42a5681149e5bfe7 Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sun, 29 Oct 2023 17:40:47 -0400 Subject: hooks: add mail-deleted hook The mail-deleted hook runs whenever a message is deleted from a folder. Note that this means moving a message from one folder to another triggers the mail-deleted hook. Changelog-added: `mail-deleted` hook that triggers when a message is removed/moved from a folder. References: https://todo.sr.ht/~rjarry/aerc/136 Signed-off-by: Jason Cox Acked-by: Robin Jarry --- lib/hooks/mail-deleted.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/hooks/mail-deleted.go (limited to 'lib/hooks') diff --git a/lib/hooks/mail-deleted.go b/lib/hooks/mail-deleted.go new file mode 100644 index 00000000..e9f13105 --- /dev/null +++ b/lib/hooks/mail-deleted.go @@ -0,0 +1,23 @@ +package hooks + +import ( + "fmt" + + "git.sr.ht/~rjarry/aerc/config" +) + +type MailDeleted struct { + Account string + Folder string +} + +func (m *MailDeleted) Cmd() string { + return config.Hooks.MailDeleted +} + +func (m *MailDeleted) Env() []string { + return []string{ + fmt.Sprintf("AERC_ACCOUNT=%s", m.Account), + fmt.Sprintf("AERC_FOLDER=%s", m.Folder), + } +} -- cgit