O_Bayes.pm 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/perl
  2. #
  3. # Dirty hack to have bayes_path availible as user defined option.
  4. # needed for multi-domain amavis filtering with per domain bayes-db
  5. # config-option in the sa-config file is now: o_bayes <path>
  6. package Mail::SpamAssassin::Plugin::O_Bayes;
  7. use Mail::SpamAssassin::Plugin;
  8. use strict;
  9. use bytes;
  10. use warnings;
  11. use Data::Dumper;
  12. use vars qw(@ISA);
  13. @ISA = qw(Mail::SpamAssassin::Plugin);
  14. sub new {
  15. my ($class, $mailsa) = @_;
  16. # the usual perlobj boilerplate to create a subclass object
  17. $class = ref($class) || $class;
  18. my $self = $class->SUPER::new($mailsa);
  19. bless ($self, $class);
  20. # register our config options
  21. $self->set_config($mailsa->{conf});
  22. # and return the new plugin object
  23. return $self;
  24. }
  25. sub set_config {
  26. my ($self, $conf) = @_;
  27. my @cmds = ();
  28. push (@cmds, {
  29. setting => 'o_bayes',
  30. default => 'bazbar',
  31. type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING,
  32. });
  33. $conf->{parser}->register_commands(\@cmds);
  34. }
  35. sub finish_parsing_end {
  36. my ($self, $params) = @_;
  37. $params->{conf}->{bayes_path} = $params->{conf}->{o_bayes}."/bayes";
  38. }
  39. 1;
  40. # vim: syntax=perl sw=4 ts=4 noet shiftround