aboutsummaryrefslogtreecommitdiffstats
path: root/config/hooks.go
blob: ed81296d72b0ce9bd426dc138da780084753235e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package config

import (
	"git.sr.ht/~rjarry/aerc/log"
	"github.com/go-ini/ini"
)

type HooksConfig struct {
	AercStartup  string `ini:"aerc-startup"`
	AercShutdown string `ini:"aerc-shutdown"`
	MailReceived string `ini:"mail-received"`
	MailDeleted  string `ini:"mail-deleted"`
	MailAdded    string `ini:"mail-added"`
}

var Hooks HooksConfig

func parseHooks(file *ini.File) error {
	err := MapToStruct(file.Section("hooks"), &Hooks, true)
	if err != nil {
		return err
	}

	log.Debugf("aerc.conf: [hooks] %#v", Hooks)
	return nil
}