]>
Commit | Line | Data |
---|---|---|
0a580593 DM |
1 | package PMG::RuleDB::Group; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
0a580593 DM |
5 | use DBI; |
6 | ||
7 | use PMG::RuleDB; | |
8 | ||
9 | # FIXME: log failures ? | |
10 | ||
11 | sub new { | |
12 | my ($type, $name, $info, $class) = @_; | |
13 | ||
14 | my $self = { | |
15 | name => $name, | |
16 | info => $info, | |
17 | class => $class, | |
18 | }; | |
19 | ||
20 | bless $self, $type; | |
21 | ||
22 | return $self; | |
23 | } | |
24 | ||
25 | sub gtype { | |
26 | my ($self, $str) = @_; | |
27 | ||
28 | if ($str eq "from") { return 0; } | |
29 | if ($str eq "to") { return 1; } | |
30 | if ($str eq "when") { return 2; } | |
31 | if ($str eq "what") { return 3; } | |
32 | if ($str eq "action") { return 4; } | |
33 | if ($str eq "greylist") { return 5; } | |
34 | ||
35 | return -1; | |
36 | } | |
37 | ||
38 | sub name { | |
39 | my ($self, $v) = @_; | |
40 | ||
41 | if (defined ($v)) { | |
42 | $self->{name} = $v; | |
43 | } | |
44 | ||
45 | $self->{name}; | |
46 | } | |
47 | ||
48 | sub info { | |
49 | my ($self, $v) = @_; | |
50 | ||
51 | if (defined ($v)) { | |
52 | $self->{info} = $v; | |
53 | } | |
54 | ||
55 | $self->{info}; | |
56 | } | |
57 | ||
58 | sub class { | |
59 | my ($self, $v) = @_; | |
60 | ||
61 | if (defined ($v)) { | |
62 | $self->{class} = $v; | |
63 | } | |
64 | ||
65 | $self->{class}; | |
66 | } | |
67 | ||
68 | sub id { | |
69 | my ($self, $v) = @_; | |
70 | ||
71 | if (defined ($v)) { | |
72 | $self->{id}=$v; | |
73 | } | |
74 | ||
75 | $self->{id}; | |
76 | } | |
77 | ||
78 | 1; |