maddy/dummy.go
fox.cpp 4af1f46a4d module: Clarify and rename BodyBuffer interface
Close method does not free the "buffer handle", it discards
the underlying data. It is renamed to Remove.

Interface itself is renamed simply into Buffer since it can be used for
any blob, not just message body.
2019-08-25 20:23:13 +03:00

54 lines
1.1 KiB
Go

package maddy
import (
"github.com/emersion/go-message/textproto"
"github.com/emersion/maddy/config"
"github.com/emersion/maddy/module"
)
// Dummy is a struct that implements AuthProvider, DeliveryTarget and Filter
// interfaces but does nothing. Useful for testing.
type Dummy struct{ instName string }
func (d *Dummy) CheckPlain(_, _ string) bool {
return true
}
func (d *Dummy) Name() string {
return "dummy"
}
func (d *Dummy) InstanceName() string {
return d.instName
}
func (d *Dummy) Init(_ *config.Map) error {
return nil
}
func (d *Dummy) Start(ctx *module.DeliveryContext, mailFrom string) (module.Delivery, error) {
return dummyDelivery{}, nil
}
type dummyDelivery struct{}
func (dd dummyDelivery) AddRcpt(to string) error {
return nil
}
func (dd dummyDelivery) Body(header textproto.Header, body module.Buffer) error {
return nil
}
func (dd dummyDelivery) Abort() error {
return nil
}
func (dd dummyDelivery) Commit() error {
return nil
}
func init() {
module.Register("dummy", nil)
module.RegisterInstance(&Dummy{instName: "dummy"}, nil)
}