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 |
#$main::DEFAULT = "$MAILDIR/SORTED/misc/Inbox"; |
30 |
|
31 |
#report("MAILDIR: $MAILDIR"); |
32 |
|
33 |
$self->jaccept("$MAILDIR/Inbox"); |
34 |
|
35 |
# ----- |
36 |
# subject-based-routing |
37 |
if ($subject =~ /h1 .+ ACTIVE SYSTEM ATTACK!/) { |
38 |
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Status/h1.service.netfrag.org"); |
39 |
} |
40 |
if ($subject =~ /Automated notification of topic changes/) { |
41 |
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Status/TWikiChanges"); |
42 |
} |
43 |
if ($subject =~ /remember/i || $subject =~ /!$/) { |
44 |
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Inbox"); |
45 |
} |
46 |
|
47 |
mark(); |
48 |
|
49 |
# ----- |
50 |
# source-routing |
51 |
#if ($incoming->from =~ /root\@smtp\.f7x\.net/i) { |
52 |
# $incoming->accept("$MAILDIR/SORTED/netfrag.org/Current/status-ns1.f7x.net"); |
53 |
#} |
54 |
if ($incoming->from =~ /(root|admin)\@cashew\.netfrag\.org/i) { |
55 |
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Status/cashew.netfrag.org"); |
56 |
} |
57 |
if ($incoming->from =~ /(root|admin)\@quepasa\.netfrag\.org/i) { |
58 |
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Status/quepasa.netfrag.org"); |
59 |
} |
60 |
if ($incoming->from =~ /(root|service|netsaint)\@h1\.service\.netfrag\.org/i) { |
61 |
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Status/h1.service.netfrag.org"); |
62 |
} |
63 |
|
64 |
mark(); |
65 |
|
66 |
# ----- |
67 |
# source && destination - routing |
68 |
if ($incoming->from =~ /andreas\.motl\@ilo\.de/ && compareTarget('joko\@netfrag\.org')) { |
69 |
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Info"); |
70 |
} |
71 |
|
72 |
mark(); |
73 |
|
74 |
# ----- |
75 |
# destination-routing |
76 |
my $bool_ilo = ($incoming->to =~ m/ilo\.de/i); |
77 |
my $bool_ilo_news1 = ($incoming->to =~ m/kritletter\@kbx\.de/i); |
78 |
my $bool_from_kolumnen_de = ($incoming->to =~ m/kolumnen\.de/i); |
79 |
my $bool_from_strixner = ($incoming->to =~ m/strixner\@web\.de/i); |
80 |
if ($bool_ilo || $bool_ilo_news1 || $bool_from_kolumnen_de || $bool_from_strixner) { |
81 |
$self->jaccept("$MAILDIR/SORTED/ilo.de/Inbox"); |
82 |
} |
83 |
|
84 |
mark(); |
85 |
|
86 |
if ($incoming->to =~ /web\.de/i) { |
87 |
$self->jaccept("$MAILDIR/SORTED/web.de/Current/Inbox"); |
88 |
} |
89 |
if ($incoming->to =~ /wor\.net/i) { |
90 |
$self->jaccept("$MAILDIR/SORTED/wor.net/Current/Inbox"); |
91 |
} |
92 |
|
93 |
mark(); |
94 |
|
95 |
# ----- |
96 |
# destination-routing - mailing-lists |
97 |
if ($incoming->to =~ /netfrag\.org/i || $incoming->to =~ /archivists-talk\@yahoogroups\.com/) { |
98 |
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Inbox"); |
99 |
} |
100 |
|
101 |
mark(); |
102 |
|
103 |
#report("end of dispatcher"); |
104 |
|
105 |
} |
106 |
|
107 |
|
108 |
1; |