http://bugzilla.spamassassin.org/show_bug.cgi?id=2163
------- Additional Comments From [EMAIL PROTECTED] 2004-01-22 22:01 -------
OK, plugin support is now in CVS.
allow_user_eval_rules is not yet implemented, BTW; only the system-wide rules
files can currently contain plugins, not user configs.
Here's a sample plugin class:
package MyPlugin;
use Mail::SpamAssassin::Plugin;
use vars qw(@ISA);
@ISA = qw(Mail::SpamAssassin::Plugin);
# constructor: register the eval rule
sub new {
my $class = shift;
my $mailsaobject = shift;
# some boilerplate...
$class = ref($class) || $class;
my $self = $class->SUPER::new($mailsaobject);
bless ($self, $class);
# the important bit!
$self->register_eval_rule ("check_for_foo");
warn "JMD registered MyPlugin $self";
return $self;
}
# and the eval rule itself
sub check_for_foo {
my ($self, $permsgstatus) = @_;
warn "JMD MyPlugin eval test called on: $self";
# ... hard work goes here...
return 1;
}
1;
To try this out, save this as e.g. /home/jm/ftp/spamassassin/plugintest.pm,
and write these lines to /etc/mail/spamassassin/plugintest.cf:
loadplugin MyPlugin /home/jm/ftp/spamassassin/plugintest.pm
header MY_PLUGIN_FOO eval:check_for_foo()
Note that that's just for eval rules; however, plugins can receive settings
from Conf.pm, and the design is such that they can receive other arbitrary
events from other parts of SA. So it should be quite usable for other stuff,
given more instrumentation points in key functions...
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.