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:
parent
0ea6a89dbe
commit
bf88f1ee99
@ -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;
|
||||
|
||||
|
@ -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 <ask@develooper.com>.');
|
||||
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 <ask@develooper.com>.');
|
||||
}
|
||||
$self->respond(214, @$msg);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub noop {
|
||||
|
Loading…
Reference in New Issue
Block a user