Pluggable help, based on patch by Jose Luis Martinez

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@825 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Hanno Hecker 2007-12-07 09:12:15 +00:00
parent 0ea6a89dbe
commit bf88f1ee99
2 changed files with 25 additions and 7 deletions

View File

@ -9,7 +9,7 @@ our @hooks = qw(
rcpt_parse rcpt_pre rcpt mail_parse mail mail_pre rcpt_parse rcpt_pre rcpt mail_parse mail mail_pre
data data_post queue_pre queue queue_post data data_post queue_pre queue queue_post
quit reset_transaction disconnect post-connection quit reset_transaction disconnect post-connection
unrecognized_command deny ok received_line unrecognized_command deny ok received_line help
); );
our %hooks = map { $_ => 1 } @hooks; our %hooks = map { $_ => 1 } @hooks;

View File

@ -474,12 +474,30 @@ sub rcpt_respond {
} }
sub help { sub help {
my $self = shift; my ($self, @args) = @_;
$self->respond(214, $self->run_hooks("help", @args);
"This is qpsmtpd " . }
($self->config('smtpgreeting') ? '' : $self->version),
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/", "See http://smtpd.develooper.com/",
'To report bugs or send comments, mail to <ask@develooper.com>.'); 'To report bugs or send comments, mail to <ask@develooper.com>.');
}
$self->respond(214, @$msg);
}
return 1;
} }
sub noop { sub noop {