]> git.proxmox.com Git - pmg-api.git/blame - PMG/RuleDB/Virus.pm
delete/deliver_quarantined_mail: use receiver instead of pmail
[pmg-api.git] / PMG / RuleDB / Virus.pm
CommitLineData
a29b9649
DM
1package PMG::RuleDB::Virus;
2
3use strict;
4use warnings;
a29b9649
DM
5use DBI;
6use Digest::SHA;
7
758c7b6b 8use PMG::Utils;
a29b9649
DM
9use PMG::RuleDB::Object;
10
11use base qw(PMG::RuleDB::Object);
12
13sub otype {
14 return 3001;
15}
16
17sub oclass {
18 return 'what';
19}
20
21sub otype_text {
22 return 'Virus Filter';
23}
24
a29b9649
DM
25sub oisedit {
26 return 0;
27}
28
29sub new {
30 my ($type, $ogroup) = @_;
31
32 my $class = ref($type) || $type;
33
7a2cf7e6 34 my $self = $class->SUPER::new($class->otype(), $ogroup);
a29b9649
DM
35
36 return $self;
37}
38
39sub load_attr {
40 my ($type, $ruledb, $id, $ogroup, $value) = @_;
41
42 my $class = ref($type) || $type;
43
44 my $obj = $class->new ($ogroup);
45 $obj->{id} = $id;
46
47 $obj->{digest} = Digest::SHA::sha1_hex($id, $ogroup);
48
49 return $obj;
50}
51
52sub save {
53 my ($self, $ruledb) = @_;
54
55 defined($self->{ogroup}) || return undef;
56
57 if (defined ($self->{id})) {
58 # update
59
60 # nothing to update
61 } else {
62 # insert
63
64 my $sth = $ruledb->{dbh}->prepare(
65 "INSERT INTO Object (Objectgroup_ID, ObjectType) VALUES (?, ?);");
66
67 $sth->execute($self->ogroup, $self->otype);
68
758c7b6b 69 $self->{id} = PMG::Utils::lastid($ruledb->{dbh}, 'object_id_seq');
a29b9649
DM
70 }
71
72 return $self->{id};
73}
74
75sub what_match {
76 my ($self, $queue, $entity, $msginfo) = @_;
77
78 if ($queue->{vinfo}) {
79 return [];
80 }
81
82 return undef;
83}
84
85sub short_desc {
86 my $self = shift;
87
88 return "active";
89}
90
d6efb336
DC
91sub properties {
92 my ($class) = @_;
93
94 return { };
95}
96
97sub get {
98 my ($self) = @_;
99
100 return { };
101}
102
103sub update {
104 my ($self, $param) = @_;
105}
106
a29b9649
DM
1071;
108
109__END__
110
111=head1 PMG::RuleDB::Virus
112
113Virus filter