File: reporterplugin.pm

package info (click to toggle)
spamassassin 4.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,988 kB
  • sloc: perl: 88,863; ansic: 5,193; sh: 3,737; javascript: 339; sql: 295; makefile: 209; python: 49
file content (60 lines) | stat: -rw-r--r-- 1,039 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
=head1 WARNING

This is a sample plugin, it may not work at all, so buyer beware.

=cut

package reporterplugin;

use strict;
use bytes;
use Cwd;

use Mail::SpamAssassin::Plugin;

use vars qw(@ISA);
@ISA = qw(Mail::SpamAssassin::Plugin);

sub new {
  my $class = shift;
  my $mailsaobject = shift;

  # some boilerplate...
  $class = ref($class) || $class;
  my $self = $class->SUPER::new($mailsaobject);
  bless ($self, $class);

  return $self;
}

sub plugin_report {
  my ($self, $options) = @_;

  if (-e 'log/rptfail') {
    $options->{report}->{report_available} = 0;
    $options->{report}->{report_return} = 0;
  }
  else {
    $options->{report}->{report_available} = 1;
    $options->{report}->{report_return} = 1;
  }

  return;
}

sub plugin_revoke {
  my ($self, $options) = @_;

  if (-e 'log/rptfail') {
    $options->{revoke}->{revoke_available} = 0;
    $options->{revoke}->{revoke_return} = 0;
  }
  else {
    $options->{revoke}->{revoke_available} = 1;
    $options->{revoke}->{revoke_return} = 1;
  }

  return;
}

1;