File: quit_fortune

package info (click to toggle)
qpsmtpd 0.94-8
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,340 kB
  • sloc: perl: 17,176; sh: 543; makefile: 186; sql: 100
file content (17 lines) | stat: -rw-r--r-- 478 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!perl -w

sub hook_quit {
    my $qp = shift->qp;

    # if she talks EHLO she is probably too sophisticated to enjoy the
    # fun, so skip it.
    return (DECLINED) if ($qp->connection->hello || '') eq "ehlo";

    my $fortune = '/usr/games/fortune';
    return DECLINED unless -e $fortune;

    my @fortune = `$fortune -s`;
    @fortune = map { chop; s/^/  \/ /; $_ } @fortune;
    $qp->respond(221, $qp->config('me') . " closing connection.", @fortune);
    return DONE;
}