File: quit_fortune

package info (click to toggle)
qpsmtpd 0.84-9
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,376 kB
  • sloc: perl: 8,012; sh: 382; makefile: 61
file content (16 lines) | stat: -rw-r--r-- 448 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

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;
}