msgpipeline: Run per-recipient body modifiers and checks

This commit is contained in:
fox.cpp 2020-02-15 16:05:50 +03:00
parent 4a875e69dc
commit aa2600aa50
No known key found for this signature in database
GPG key ID: E76D97CCEDE90B6C
2 changed files with 19 additions and 5 deletions

View file

@ -311,8 +311,11 @@ func (dd *msgpipelineDelivery) Body(ctx context.Context, header textproto.Header
if err := dd.checkRunner.checkBody(ctx, dd.sourceBlock.checks, header, body); err != nil {
return err
}
// TODO: Decide whether per-recipient body checks should be executed.
for blk := range dd.rcptModifiersState {
if err := dd.checkRunner.checkBody(ctx, blk.checks, header, body); err != nil {
return err
}
}
if err := dd.checkRunner.applyResults(dd.d.Hostname, &header); err != nil {
return err
}
@ -325,6 +328,11 @@ func (dd *msgpipelineDelivery) Body(ctx context.Context, header textproto.Header
if err := dd.sourceModifiersState.RewriteBody(ctx, &header, body); err != nil {
return err
}
for _, modifiers := range dd.rcptModifiersState {
if err := modifiers.RewriteBody(ctx, &header, body); err != nil {
return err
}
}
for _, delivery := range dd.deliveries {
if err := delivery.Body(ctx, header, body); err != nil {
@ -384,6 +392,12 @@ func (dd *msgpipelineDelivery) BodyNonAtomic(ctx context.Context, c module.Statu
setStatusAll(err)
return
}
for _, modifiers := range dd.rcptModifiersState {
if err := modifiers.RewriteBody(ctx, &header, body); err != nil {
setStatusAll(err)
return
}
}
for _, delivery := range dd.deliveries {
partDelivery, ok := delivery.Delivery.(module.PartialDelivery)