aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorBence Ferdinandy <bence@ferdinandy.com>2024-05-30 11:30:18 +0200
committerRobin Jarry <robin@jarry.cc>2024-06-05 08:41:13 +0200
commitfd35044023b3b6cae4eb95c4f4b997873739b153 (patch)
treea46e7e7b0bb279d281bd785e9d0c259e8894ca20 /app
parent47c226687265ff29969fd73cdc69a938fae20d4c (diff)
downloadaerc-fd35044023b3b6cae4eb95c4f4b997873739b153.tar.gz
hooks: add AERC_ACCOUNT_BACKEND to hooks with AERC_ACCOUNT
It can be good to know the backend used for an account in a hook. Add this information to all hooks that already pass the account name along. Changelog-added: Added `AERC_ACCOUNT_BACKEND` to hooks with `AERC_ACCOUNT`. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app')
-rw-r--r--app/account.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/account.go b/app/account.go
index 20e64e74..7ce10f0f 100644
--- a/app/account.go
+++ b/app/account.go
@@ -247,6 +247,7 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
if dir != nil {
role = string(dir.Role)
}
+ backend := acct.AccountConfig().Backend
store := lib.NewMessageStore(acct.worker,
acct.sortCriteria(uiConf),
uiConf.ThreadingEnabled,
@@ -259,6 +260,7 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
func(msg *models.MessageInfo) {
err := hooks.RunHook(&hooks.MailReceived{
Account: acct.Name(),
+ Backend: backend,
Folder: name,
Role: role,
MsgInfo: msg,
@@ -274,6 +276,7 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
}, func() {
err := hooks.RunHook(&hooks.MailDeleted{
Account: acct.Name(),
+ Backend: backend,
Folder: name,
Role: role,
})
@@ -284,6 +287,7 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
}, func(dest string) {
err := hooks.RunHook(&hooks.MailAdded{
Account: acct.Name(),
+ Backend: backend,
Folder: dest,
Role: role,
})
@@ -294,6 +298,7 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
}, func(add []string, remove []string) {
err := hooks.RunHook(&hooks.TagModified{
Account: acct.Name(),
+ Backend: backend,
Add: add,
Remove: remove,
})
@@ -304,6 +309,7 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
}, func(flagname string) {
err := hooks.RunHook(&hooks.FlagChanged{
Account: acct.Name(),
+ Backend: backend,
Folder: acct.SelectedDirectory(),
Role: role,
FlagName: flagname,