Hi everyone,Some time ago there was discussion about contributors distributing plugins on CPAN. I made a change so that should be possible. I didn't do more than the most basic testing, so I didn't commit it. Feedback welcome.
The patch below should apply to the latest code from the 0.3x branch [1]. After applying the patch you should be able to make a module like the following (just install it as a regular perl module) and then add "My::Plugin" to the config/plugins file to load it.
TODO: 1) Testing2) Make load_plugins or Qpsmtpd::Plugin smart enough that we won't need plugin_name in each plugin.
package My::Plugin;
use strict;
use base qw(Qpsmtpd::Plugin);
use Qpsmtpd::Constants;
sub plugin_name { __PACKAGE__ }
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;
# local %ENV = ();
my @fortune = `$fortune -s`;
@fortune = map { chop; s/^/ \/ /; $_ } @fortune;
$qp->respond(221, $qp->config('me') . " closing connection.",
@fortune);
return DONE; } 1; - ask [1] http://svn.perl.org/qpsmtpd/branches/0.3x/
plugin_modules.patch
Description: Binary data
-- http://askask.com/ - http://develooper.com/
