diff options
| author | Shulhan <ms@kilabit.info> | 2019-01-15 01:15:00 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2019-01-15 01:15:00 +0700 |
| commit | 1e8fc58b394bae4fe1c034d35c6bf667c45364e1 (patch) | |
| tree | c69d6ce2fb0f30fb2e47b7791eb6124145089bb6 | |
| parent | 0c4ae654c0fd176fbf7325149993c5e588edf1f5 (diff) | |
| download | pakakeh.go-1e8fc58b394bae4fe1c034d35c6bf667c45364e1.tar.xz | |
lib/smtp: add function Params to Extension interface
The Params will return the list of argument that supported by extension.
| -rw-r--r-- | lib/smtp/extension.go | 5 | ||||
| -rw-r--r-- | lib/smtp/extension_dsn.go | 7 | ||||
| -rw-r--r-- | lib/smtp/server.go | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/smtp/extension.go b/lib/smtp/extension.go index 016d473e..6adcecc0 100644 --- a/lib/smtp/extension.go +++ b/lib/smtp/extension.go @@ -14,6 +14,11 @@ type Extension interface { Name() string // + // Params return the SMTP extension parameters. + // + Params() string + + // // ValidateCommand validate the command parameters, if the extension // provide custom parameters. // diff --git a/lib/smtp/extension_dsn.go b/lib/smtp/extension_dsn.go index b59429df..0de388cb 100644 --- a/lib/smtp/extension_dsn.go +++ b/lib/smtp/extension_dsn.go @@ -15,6 +15,13 @@ func (dsn *extDSN) Name() string { } // +// Params return the SMTP extension parameters. +// +func (dns *extDSN) Params() string { + return "" +} + +// // ValidateCommand validate command parameter for MAIL and RCPT. // func (dsn *extDSN) ValidateCommand(cmd *Command) (err error) { diff --git a/lib/smtp/server.go b/lib/smtp/server.go index de226737..51080c7f 100644 --- a/lib/smtp/server.go +++ b/lib/smtp/server.go @@ -214,6 +214,7 @@ func (srv *Server) handleCommand(recv *receiver, cmd *Command) (err error) { body := make([]string, len(srv.Exts)) for x, ext := range srv.Exts { body[x] = ext.Name() + body[x] += " " + ext.Params() } if !recv.isAuthenticated { |
