1 |
package rules; |
2 |
|
3 |
use strict; |
4 |
# don't use warnings; |
5 |
|
6 |
|
7 |
my $mc = 0; |
8 |
sub mark { |
9 |
$mc++; |
10 |
#report("mark $mc"); |
11 |
} |
12 |
|
13 |
sub dispatch { |
14 |
|
15 |
my $self = shift; |
16 |
|
17 |
my $incoming = $self->{incoming}; |
18 |
my $MAILDIR = $self->{settings}->{MAILDIR}; |
19 |
|
20 |
my $from = $incoming->from; |
21 |
my $to = $incoming->to; |
22 |
my $subject = $incoming->subject; |
23 |
|
24 |
chomp($from); |
25 |
chomp($to); |
26 |
chomp($subject); |
27 |
|
28 |
# ----- |
29 |
# target-based-routing (gateway to news in this case...) |
30 |
|
31 |
print "to: $to", "\n"; |
32 |
|
33 |
|
34 |
# --- @netfrag.org |
35 |
|
36 |
# links-computing@netfrag.org |
37 |
$self->copy('Newsgate', 'nfo.links.computing') if $to =~ m/links-computing/; |
38 |
|
39 |
# test@netfrag.org |
40 |
$self->copy('Newsgate', 'alt.test') if $to =~ m/test\@.*\.netfrag\.org/; |
41 |
|
42 |
# cvs-log@netfrag.org |
43 |
$self->copy('Newsgate', 'nfo.log.cvs') if $to =~ m/cvs-log\@.*netfrag\.org/; |
44 |
|
45 |
# faq@netfrag.org |
46 |
$self->copy('Newsgate', 'nfo.support.faq') if $to =~ m/faq\@.*netfrag\.org/; |
47 |
|
48 |
# caesar@netfrag.org - Collaborative And Easy System ARchitecture |
49 |
$self->copy('Newsgate', 'nfo.caesar') if $to =~ m/caesar\@.*netfrag\.org/; |
50 |
|
51 |
# support@netfrag.org |
52 |
#$self->copy('Newsgate', 'nfo.support') if $to =~ m/support\@.*netfrag\.org/; |
53 |
|
54 |
# links-misc@netfrag.org |
55 |
$self->copy('Newsgate', 'nfo.links.misc') if $to =~ m/links-misc/; |
56 |
|
57 |
# links-php@netfrag.org |
58 |
$self->copy('Newsgate', 'nfo.dev.php') if $to =~ m/links-php/; |
59 |
|
60 |
# dev-php@netfrag.org |
61 |
$self->copy('Newsgate', 'nfo.dev.php') if $to =~ m/dev-php/; |
62 |
|
63 |
# sysadmin-debian@netfrag.org |
64 |
$self->copy('Newsgate', 'nfo.sysadmin.debian') if $to =~ m/sysadmin-debian/; |
65 |
|
66 |
# sysadmin@netfrag.org |
67 |
# TODO: investigate this from the workflow point: |
68 |
# this could act as a dispatcher to the timetracker for certain topic-hierarchies |
69 |
$self->copy('Newsgate', 'nfo.sysadmin.tutos') if $to =~ m/sysadmin\@.*netfrag\.org/; |
70 |
|
71 |
|
72 |
# --- @service.netfrag.org |
73 |
|
74 |
# alert@service.netfrag.org |
75 |
# TODO: branch part of msg to sms here!!! |
76 |
$self->copy('Newsgate', 'nfo.support') if $to =~ m/alert\@service\.netfrag\.org/; |
77 |
$self->copy('Newsgate', 'nfo.support') if $to =~ m/.*\@h1\.service\.netfrag\.org/; |
78 |
|
79 |
# logcheck@service.netfrag.org |
80 |
$self->copy('Newsgate', 'nfo.support') if $to =~ m/logcheck\@service\.netfrag\.org/; |
81 |
|
82 |
|
83 |
# --- ignore (all above get *copied*) |
84 |
|
85 |
$self->ignore(); |
86 |
#$self->accept("$MAILDIR/Inbox"); |
87 |
|
88 |
} |
89 |
|
90 |
1; |
91 |
__END__ |
92 |
|