plugins/quit_fortune
raw| 1 | #!perl -w |
| 2 | |
| 3 | sub hook_quit { |
| 4 | my $qp = shift->qp; |
| 5 | |
| 6 | # if she talks EHLO she is probably too sophisticated to enjoy the |
| 7 | # fun, so skip it. |
| 8 | return (DECLINED) if ($qp->connection->hello || '') eq "ehlo"; |
| 9 | |
| 10 | my $fortune = '/usr/games/fortune'; |
| 11 | return DECLINED unless -e $fortune; |
| 12 | |
| 13 | my @fortune = `$fortune -s`; |
| 14 | @fortune = map { chop; s/^/ \/ /; $_ } @fortune; |
| 15 | $qp->respond(221, $qp->config('me') . " closing connection.", @fortune); |
| 16 | return DONE; |
| 17 | } |