| 1 |
package rules; |
| 2 |
|
| 3 |
use strict; |
| 4 |
# don't use warnings; |
| 5 |
|
| 6 |
use vars qw( $incoming $MAILDIR ); |
| 7 |
|
| 8 |
my $mc = 0; |
| 9 |
sub mark { |
| 10 |
$mc++; |
| 11 |
#report("mark $mc"); |
| 12 |
} |
| 13 |
|
| 14 |
sub dispatch { |
| 15 |
|
| 16 |
my $from = $incoming->from; |
| 17 |
my $to = $incoming->to; |
| 18 |
my $subject = $incoming->subject; |
| 19 |
|
| 20 |
chomp($from); |
| 21 |
chomp($to); |
| 22 |
chomp($subject); |
| 23 |
|
| 24 |
|
| 25 |
#$main::DEFAULT = "$MAILDIR/SORTED/misc/Inbox"; |
| 26 |
|
| 27 |
#report("MAILDIR: $MAILDIR"); |
| 28 |
|
| 29 |
# ----- |
| 30 |
# subject-based-routing |
| 31 |
if ($subject =~ /h1 .+ ACTIVE SYSTEM ATTACK!/) { |
| 32 |
jaccept("$MAILDIR/SORTED/netfrag.org/Status/h1.service.netfrag.org"); |
| 33 |
} |
| 34 |
if ($subject =~ /Automated notification of topic changes/) { |
| 35 |
jaccept("$MAILDIR/SORTED/netfrag.org/Status/TWikiChanges"); |
| 36 |
} |
| 37 |
if ($subject =~ /remember/i || $subject =~ /!$/) { |
| 38 |
jaccept("$MAILDIR/SORTED/netfrag.org/Inbox"); |
| 39 |
} |
| 40 |
|
| 41 |
mark(); |
| 42 |
|
| 43 |
# ----- |
| 44 |
# source-routing |
| 45 |
#if ($incoming->from =~ /root\@smtp\.f7x\.net/i) { |
| 46 |
# $incoming->accept("$MAILDIR/SORTED/netfrag.org/Current/status-ns1.f7x.net"); |
| 47 |
#} |
| 48 |
if ($incoming->from =~ /(root|admin)\@cashew\.netfrag\.org/i) { |
| 49 |
jaccept("$MAILDIR/SORTED/netfrag.org/Status/cashew.netfrag.org"); |
| 50 |
} |
| 51 |
if ($incoming->from =~ /(root|admin)\@quepasa\.netfrag\.org/i) { |
| 52 |
jaccept("$MAILDIR/SORTED/netfrag.org/Status/quepasa.netfrag.org"); |
| 53 |
} |
| 54 |
if ($incoming->from =~ /(root|service|netsaint)\@h1\.service\.netfrag\.org/i) { |
| 55 |
jaccept("$MAILDIR/SORTED/netfrag.org/Status/h1.service.netfrag.org"); |
| 56 |
} |
| 57 |
|
| 58 |
mark(); |
| 59 |
|
| 60 |
# ----- |
| 61 |
# source && destination - routing |
| 62 |
if ($incoming->from =~ /andreas\.motl\@ilo\.de/ && compareTarget('joko\@netfrag\.org')) { |
| 63 |
jaccept("$MAILDIR/SORTED/netfrag.org/Info"); |
| 64 |
} |
| 65 |
|
| 66 |
mark(); |
| 67 |
|
| 68 |
# ----- |
| 69 |
# destination-routing |
| 70 |
my $bool_ilo = ($incoming->to =~ m/ilo\.de/i); |
| 71 |
my $bool_ilo_news1 = ($incoming->to =~ m/kritletter\@kbx\.de/i); |
| 72 |
my $bool_from_kolumnen_de = ($incoming->to =~ m/kolumnen\.de/i); |
| 73 |
my $bool_from_strixner = ($incoming->to =~ m/strixner\@web\.de/i); |
| 74 |
if ($bool_ilo || $bool_ilo_news1 || $bool_from_kolumnen_de || $bool_from_strixner) { |
| 75 |
jaccept("$MAILDIR/SORTED/ilo.de/Inbox"); |
| 76 |
} |
| 77 |
|
| 78 |
mark(); |
| 79 |
|
| 80 |
if ($incoming->to =~ /web\.de/i) { |
| 81 |
jaccept("$MAILDIR/SORTED/web.de/Current/Inbox"); |
| 82 |
} |
| 83 |
if ($incoming->to =~ /wor\.net/i) { |
| 84 |
jaccept("$MAILDIR/SORTED/wor.net/Current/Inbox"); |
| 85 |
} |
| 86 |
|
| 87 |
mark(); |
| 88 |
|
| 89 |
# ----- |
| 90 |
# destination-routing - mailing-lists |
| 91 |
if ($incoming->to =~ /netfrag\.org/i || $incoming->to =~ /archivists-talk\@yahoogroups\.com/) { |
| 92 |
jaccept("$MAILDIR/SORTED/netfrag.org/Inbox"); |
| 93 |
} |
| 94 |
|
| 95 |
mark(); |
| 96 |
|
| 97 |
#report("end of dispatcher"); |
| 98 |
|
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
1; |