diff --git a/lib/Qpsmtpd/Plugin.pm b/lib/Qpsmtpd/Plugin.pm index 0c542a0..2dca9dc 100644 --- a/lib/Qpsmtpd/Plugin.pm +++ b/lib/Qpsmtpd/Plugin.pm @@ -9,7 +9,7 @@ our @hooks = qw( rcpt_parse rcpt_pre rcpt mail_parse mail mail_pre data data_post queue_pre queue queue_post quit reset_transaction disconnect post-connection - unrecognized_command deny ok received_line + unrecognized_command deny ok received_line help ); our %hooks = map { $_ => 1 } @hooks; diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index f0c4b7f..12ba5dc 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -474,12 +474,30 @@ sub rcpt_respond { } sub help { - my $self = shift; - $self->respond(214, - "This is qpsmtpd " . - ($self->config('smtpgreeting') ? '' : $self->version), - "See http://smtpd.develooper.com/", - 'To report bugs or send comments, mail to .'); + my ($self, @args) = @_; + $self->run_hooks("help", @args); +} + +sub help_respond { + my ($self, $rc, $msg, $args) = @_; + + return 1 + if $rc == DONE; + + if ($rc == DENY) { + $msg->[0] ||= "Syntax error, command not recognized"; + $self->respond(500, @$msg); + } + else { + unless ($msg->[0]) { + @$msg = ( + "This is qpsmtpd " . ($self->config('smtpgreeting') ? '' : $self->version), + "See http://smtpd.develooper.com/", + 'To report bugs or send comments, mail to .'); + } + $self->respond(214, @$msg); + } + return 1; } sub noop {