refactor ParseMessageFormat to use a ctx object

This commit is contained in:
Reto Brunner 2020-10-14 08:42:26 +02:00
parent b6bcf89784
commit 75cbf76732
3 changed files with 74 additions and 60 deletions

View file

@ -37,9 +37,12 @@ func (trig *TriggersConfig) ExecNewEmail(account *AccountConfig,
err := trig.ExecTrigger(trig.NewEmail,
func(part string) (string, error) {
formatstr, args, err := format.ParseMessageFormat(
account.From,
part,
conf.Ui.TimestampFormat, account.Name, 0, msg, false)
part, conf.Ui.TimestampFormat,
format.Ctx{
FromAddress: account.From,
AccountName: account.Name,
MsgInfo: msg},
)
if err != nil {
return "", err
}