]>
git.proxmox.com Git - pmg-api.git/blob - PMG/RuleDB/ReportSpam.pm
1 package PMG
::RuleDB
::ReportSpam
;
11 use PMG
::RuleDB
::Object
;
13 use base
qw(PMG::RuleDB::Object);
40 my ($type, $ogroup) = @_;
42 my $class = ref($type) || $type;
44 my $self = $class->SUPER::new
($class->otype(), $ogroup);
50 my ($type, $ruledb, $id, $ogroup, $value) = @_;
52 my $class = ref($type) || $type;
54 my $obj = $class->new($ogroup);
61 my ($self, $ruledb) = @_;
63 defined($self->{ogroup
}) || return undef;
65 if (defined ($self->{id
})) {
73 my $sth = $ruledb->{dbh
}->prepare(
74 "INSERT INTO Object (Objectgroup_ID, ObjectType) VALUES (?, ?);");
76 $sth->execute($self->ogroup, $self->otype);
78 $self->{id
} = PMG
::Utils
::lastid
($ruledb->{dbh
}, 'object_id_seq');
85 my ($self, $queue, $ruledb, $mod_group, $targets,
86 $msginfo, $vars, $marks) = @_;
88 my $subgroups = $mod_group->subgroups($targets);
90 foreach my $ta (@$subgroups) {
91 my ($tg, $entity) = (@$ta[0], @$ta[1]);
93 if ($msginfo->{testmode
}) {
94 my $fh = $msginfo->{test_fh
};
95 print $fh "report as spam\n";
98 my $spamtest = $queue->{sa
};
100 $queue->{fh
}->seek (0, 0);
101 *SATMP
= \
*{$queue->{fh
}};
102 my $mail = $spamtest->parse(\
*SATMP
);
104 $spamtest->report_as_spam($mail);
108 $queue->set_status ($tg, 'delivered');
121 =head1 PMG::RuleDB::ReportSpam