+sa-learn(1) support.
[PerlMail.git] / PerlMail / Config.pm
index 49f6a58..3b23b0c 100644 (file)
@@ -43,7 +43,7 @@ require Mail::Alias;
 
 BEGIN {
        for (qw(headerhas store headeris did dnsbl store_muttrc_alternates Received_for parts_linear mime_type
-                       body_first mimehead razor2 header_remap)) {
+                       body_first mimehead spamassassin header_remap)) {
                eval 'sub '.$_.' { return ::'.$_.'(@_); }';
                }
        }
@@ -106,15 +106,28 @@ my @lists=qw(
                4cinfo@atrey.karlin.mff.cuni.cz
                libtool@gnu.org
                libtool-patches@gnu.org
-               wine-license@winehq.com
-               wine-devel@winehq.com
-               wine-patches@winehq.com
+               wine-license@winehq.org
+               wine-devel@winehq.org
+               wine-patches@winehq.org
                gtk-devel-list@gnome.org
                gnome-vfs-list@gnome.org
                captive-announce-list@jankratochvil.net
                captive-list@jankratochvil.net
                captive-devel-list@jankratochvil.net
+               linux-ntfs-announce@lists.sourceforge.net
+               linux-ntfs-dev@lists.sourceforge.net
+               orbit-list@gnome.org
+               devel@kannel.org
+               automake@gnu.org
+               autoconf@gnu.org
+               autoconf-patches@gnu.org
+               wget-patches@sunsite.dk
+               wget@sunsite.dk
+               mailman-developers@python.org
+               wineconf@winehq.org
+               prague-pm@pm.org
                );
+               #4c-list@vellum.cz
 
 # Pathname of the original sendmail(8) binary:
 our $sendmail_orig=(-x ($_="/usr/sbin/sendmail-orig") ? $_ : "/usr/sbin/sendmail");
@@ -223,6 +236,11 @@ our @dnsbl_whitelist=(
                "65.113.40.131",        # bozo.vmware.com: qwest.net.spam-support.blackholes.five-ten-sg.com.
                "66.218.85.33",         # mta2.wss.scd.yahoo.com: yahoo.com.spam.blackholes.five-ten-sg.com.
                "212.80.76.42",         # mx2.seznam.cz: seznam.cz.free.blackholes.five-ten-sg.com.
+               "64.110.204.63",        # hsdbrg64-110-204-63.sasknet.sk.ca: 64.110.202.181.sasknet.sk.ca.misc.spam.blackholes.five-ten-sg.com.
+               "212.80.76.44",         # mx1.seznam.cz: 44.76.80.212.blackholes.five-ten-sg.com.
+               "212.80.76.29",         # prace.seznam.cz: 212.80.76.42.seznam.cz.free.blackholes.five-ten-sg.com
+               "193.252.22.30",        # smtp1.wanadoo.fr: 30.22.252.193.blackholes.five-ten-sg.com
+               "213.151.87.16",        # posta.dobnet.cz: 16.87.151.213.relays.ordb.org
                );
 
 our $Audit;    # imported
@@ -233,7 +251,6 @@ our $store_ignore;  # imported
 sub audit
 {
        $store_profile=undef();
-       # TODO: <short-m@> storage?
 
        # never spawn new mail if FROM_MAILER
        # $isFROM_MAILER postponed after maillists as they may look as FROM_MAILER
@@ -272,7 +289,7 @@ sub audit
                # Do not local $store_file as it is our-imported
                $store_profile="silent";
                local $_;
-               store "=spam".($_ eq 1 ? "" : ";$_")      if $_=razor2();
+               store "=spam".($_ eq 1 ? "" : ";$_")      if $_=spamassassin();
                };
        $store_profile=undef();
        return if did sub {
@@ -282,9 +299,10 @@ sub audit
                store "=spam"                      .";$_","log" if $_=dnsbl '.relays.ordb.org.' ,1;     # all hosts
                store "=spam"                      .";$_","log" if $_=dnsbl '.blackholes.mail-abuse.org.' ,1;   # all hosts
                # we don't check all hosts as they can be "dialup" category, FIXME: check for it
-               store "=spam"                      .";$_","log" if $_=dnsbl '.blackholes.five-ten-sg.com.',0; # just first
+#              store "=spam"                      .";$_","log" if $_=dnsbl '.blackholes.five-ten-sg.com.',0; # just first
                # I don't send viruses but viruses propagate mails of mine
                store "=spam"                                   if headeris "X-Mailer",'ravmd/8.3.2';
+               store "=spam"                                   if $isFROM_MAILER && headeris("To",'<short@ucw.cz>');
                };
        $store_profile=undef();
 
@@ -343,12 +361,13 @@ sub audit
        store "=mffstatnice","bell"  if headeris "List-Post",'<statnice@atrey.karlin.mff.cuni.cz>';
        store "=hw","log"            if headeris "List-Post",'<hw-news@list.gin.cz>';
        store "=gnokii","log"        if headeris "List-Id"  ,'<gnokii-users.mail.freesoftware.fsf.org>';
-       store "=winelic","log"       if headeris "List-Id"  ,'<wine-license.winehq.com>';
-       store "=wined","silent"      if headeris "List-Id"  ,'<wine-devel.winehq.org>';
-       store "=winepat","silent"    if headeris "List-Id"  ,'<wine-patches.winehq.com>';
-       store "=winecvs","silent"    if headeris "List-Id"  ,'<wine-cvs.winehq.com>';
-       store "=wineann","log"       if headeris "List-Id"  ,'<wine-announce.winehq.com>';
-       store "=ros","log"           if headeris "List-Id"  ,'<ros-general.reactos.geldorp.nl>';
+       store "=winelic","log"       if headeris "List-Id"  ,'<wine-license.winehq.org>';
+       store "=wined","log"         if headeris "List-Id"  ,'<wine-devel.winehq.org>';
+       store "=winepat","silent"    if headeris "List-Id"  ,'<wine-patches.winehq.org>';
+       store "=winecvs","silent"    if headeris "List-Id"  ,'<wine-cvs.winehq.org>';
+       store "=wineann","log"       if headeris "List-Id"  ,'<wine-announce.winehq.org>';
+       store "=wineconf","log"      if headeris "List-Id"  ,'<wineconf.winehq.org>';
+       store "=ros","log"           if headeris "List-Id"  ,'<ros-general.reactos.com>';
        store "=roskernel","log"     if headeris "List-Id"  ,'<ros-kernel.reactos.com>';
        store "=roscvs","silent"     if headeris "List-Id"  ,'<ros-cvs.reactos.com>';
        store "=rosbug","log"        if headeris "Reply-To" ,'<scarab@reactos.wox.org>';
@@ -359,7 +378,7 @@ sub audit
        store "=tacacs","log"        if headeris "Sender"   ,'<tacplus-l@disaster.com>';
        store "=tacacs","log"        if headeris "Sender"   ,'<owner-tacplus-l@disaster.com>';
        store "=tacacs","log"        if headeris "List-Id"  ,'<devel.lists.tacplus.org>';
-       store "=pm","sms"            if headeris "Sender"   ,'<owner-prague-pm@pm.org>';
+       store "=pm","log"            if headeris "Sender"   ,'<owner-prague-pm@pm.org>';
        store "=radary","log"        if headeris "Reply-To" ,'<pha@radary.cz>';
        store "=dnet","log"          if headeris "Sender"   ,'<@lists.distributed.net>';
        store "=linux-input","log"   if headeris "List-Post",'<linux-input@atrey.karlin.mff.cuni.cz>';
@@ -376,9 +395,34 @@ sub audit
                                        && $Audit->subject()=~/^'.*' has been updated!$/;
        store "=libtoold","log"      if headeris "List-Id"  ,'<libtool.gnu.org>';
        store "=libtoolpat","log"    if headeris "List-Id"  ,'<libtool-patches.gnu.org>';
-       store "=cap","bell"          if headeris "List-Id"  ,'<captive-list.jankratochvil.net>';
-       store "=capd","bell"         if headeris "List-Id"  ,'<captive-devel-list.jankratochvil.net>';
-       store "=capann","bell"       if headeris "List-Id"  ,'<captive-announce-list.jankratochvil.net>';
+       store "=automake","log"      if headeris "List-Id"  ,'<automake.gnu.org>';
+       store "=autoconf","log"      if headeris "List-Id"  ,'<autoconf.gnu.org>';
+       store "=autoconfpat","log"   if headeris "List-Id"  ,'<autoconf-patches.gnu.org>';
+       my %mailman=(
+                       '<captive-admin@>'=>"=caperr",
+                       '<captive-devel-admin@>'=>"=caperr",
+                       '<captive-announce-admin@>'=>"=caperr",
+                       '<4c-admin@>'=>"=4cerr",
+                       );
+       if (!did sub {
+                       while ((my($mailaddr,$folder)=each(%mailman))) {
+                               (my $maillistaddr=$mailaddr)=~s/-admin/-list$&/;
+                               store $folder,"log" if (headeris("From",'<mailman-owner@vellum.cz>')&&headeris("To",$mailaddr))
+                                               || headeris("From",$maillistaddr)
+                                               || headeris("To",$maillistaddr)
+                                               || headeris("From",$mailaddr);
+                               }
+                       }) {
+               store "=cap","bell"        if headeris "List-Id"  ,'<captive-list.jankratochvil.net>';
+               store "=capd","bell"       if headeris "List-Id"  ,'<captive-devel-list.jankratochvil.net>';
+               store "=capann","bell"     if headeris "List-Id"  ,'<captive-announce-list.jankratochvil.net>';
+               store "=4c","bell"         if headeris "List-Id"  ,'<4c-list.vellum.cz>';
+               }
+       store "=ntfsann","log"       if headeris "List-Id"  ,'<linux-ntfs-announce.lists.sourceforge.net>';
+       store "=ntfsd","log"         if headeris "List-Id"  ,'<linux-ntfs-dev.lists.sourceforge.net>';
+       store "=orbit","log"         if headeris "List-Id"  ,'<orbit-list.gnome.org>';
+       store "=kand","log"          if headeris "List-Id"  ,'<devel.kannel.org>';
+       store "=mailmand","log"      if headeris "List-Id"  ,'<mailman-developers.python.org>';
        # own webs
        store "=energie","bell"      if headeris "From"     ,qr/^EnergieWeb/;
        store "=ats","log"           if headeris("From"     ,'<root@ms.atspraha.cz>')
@@ -387,11 +431,15 @@ sub audit
        store "=www-sms","log"       if headeris "List-Id"  ,'<www-sms-developers.lists.sourceforge.net>';
 
        # Petr Koutecky does not mark his Stuff
-       store "=koutecky","log"      if headeris "From"     ,'<velkyhroch@seznam.cz>';
+       store "=koutecky","log"      if headeris "Return-Path",'<velkyhroch@seznam.cz>';
+       store "=koutecky","log"      if headeris "Return-Path",'<pk.petr@centrum.cz>';
 
        store "=errm","bell"         if $isFROM_MAILER && !did();
 
-       store "==","sms"             if !did;
+       if (!did) {
+               store "==","sms";
+               spamassassin "sa-learn --ham";
+               }
 }
 
 sub audit_sms_address