From c1f5b3d9b6cf71a82506eef3400b55383ae1ad49 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 7 Jun 2020 12:04:24 -0400 Subject: [PATCH] Rename smtp.Server.OnMessageDelievered to DeliverMessage. --- smtp.go | 2 +- smtp/conn.go | 2 +- smtp/relay.go | 2 +- smtp/relay_test.go | 2 +- smtp/server.go | 4 ++-- smtp_test.go | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/smtp.go b/smtp.go index 2a27279..55484a2 100644 --- a/smtp.go +++ b/smtp.go @@ -125,7 +125,7 @@ func (server *smtpServer) Authenticate(authz, authc, passwd string) bool { return false } -func (server *smtpServer) OnMessageDelivered(en smtp.Envelope) *smtp.ReplyLine { +func (server *smtpServer) DeliverMessage(en smtp.Envelope) *smtp.ReplyLine { maildrop := server.maildropForAddress(en.RcptTo[0]) if maildrop == "" { // TODO: log error diff --git a/smtp/conn.go b/smtp/conn.go index 9020073..8093945 100644 --- a/smtp/conn.go +++ b/smtp/conn.go @@ -428,7 +428,7 @@ func (conn *connection) doDATA() { env.Data = append(trace, env.Data...) if conn.delivery == deliverInbound { - if reply := conn.server.OnMessageDelivered(env); reply != nil { + if reply := conn.server.DeliverMessage(env); reply != nil { conn.log.Warn("message was rejected", zap.String("id", env.ID)) conn.reply(*reply) return diff --git a/smtp/relay.go b/smtp/relay.go index 713eee9..5d65d84 100644 --- a/smtp/relay.go +++ b/smtp/relay.go @@ -153,5 +153,5 @@ func deliverRelayFailure(server Server, env Envelope, log *zap.Logger, to, error mw.Close() failure.Data = buf.Bytes() - server.OnMessageDelivered(failure) + server.DeliverMessage(failure) } diff --git a/smtp/relay_test.go b/smtp/relay_test.go index 175eea5..6ad6a08 100644 --- a/smtp/relay_test.go +++ b/smtp/relay_test.go @@ -25,7 +25,7 @@ type deliveryServer struct { messages []Envelope } -func (s *deliveryServer) OnMessageDelivered(env Envelope) *ReplyLine { +func (s *deliveryServer) DeliverMessage(env Envelope) *ReplyLine { s.messages = append(s.messages, env) return nil } diff --git a/smtp/server.go b/smtp/server.go index b991a22..8697eb1 100644 --- a/smtp/server.go +++ b/smtp/server.go @@ -94,7 +94,7 @@ type Server interface { VerifyAddress(mail.Address) ReplyLine // Verify that the authc+passwd identity can send mail as authz. Authenticate(authz, authc, passwd string) bool - OnMessageDelivered(Envelope) *ReplyLine + DeliverMessage(Envelope) *ReplyLine // RelayMessage instructs the server to send the Envelope to another // MTA for outbound delivery. @@ -115,7 +115,7 @@ func (*EmptyServerCallbacks) Authenticate(authz, authc, passwd string) bool { return false } -func (*EmptyServerCallbacks) OnMessageDelivered(Envelope) *ReplyLine { +func (*EmptyServerCallbacks) DeliverMessage(Envelope) *ReplyLine { return nil } diff --git a/smtp_test.go b/smtp_test.go index d1239ea..40d0dca 100644 --- a/smtp_test.go +++ b/smtp_test.go @@ -85,7 +85,7 @@ func TestMessageDelivery(t *testing.T) { ID: "msgid", } - if rl := s.OnMessageDelivered(env); rl != nil { + if rl := s.DeliverMessage(env); rl != nil { t.Errorf("Failed to deliver message: %v", rl) } -- 2.43.5