--- YoSucker-pr29/lib/sputnik.pm        Tue Apr  1 05:42:53 2003
+++ YoSucker-pr29.jff/lib/sputnik.pm    Sun May 11 18:23:24 2003
@@ -82,7 +82,13 @@
                FASTCHECK => "0",
                CLEAN => "0",
                PROXY_PROTO => "i_ve_been_lazy_to_recode",
-               NOFROM => "0"
+               NOFROM => "0",
+                USESA => "0",
+                NODOWNLOAD => "0",
+                SUSPECTSPAMSCORE => "4.5",
+                SUSPECTSPAMFOLDER => "Suspected Spam",
+                SPAMSCORE => "8",
+                SPAMFOLDER => "Spam"
                 };
 
   # Store the lockfile variable again.
@@ -402,6 +408,8 @@
 
   my %repoz;
   my @new_msgz;
+  my @spam_msgz;
+  my @suspect_msgz;
 
   # See if it's a CLEAN run or a normal session...
   if ($class->{config}{CLEAN} ne "KillEmAll") {
@@ -495,8 +503,27 @@
             $problematic{$item} = 1;
          }
          else {
-            # Save downloaded message ID in the repository
-            print FILE $item."\n" or $class->die3("\nCannot write to REPOSITORY!!! Disk full?\n");
+            # SpamAssassin Stuff
+            if ($class->{config}{USESA}) {
+              eval "use Mail::SpamAssassin;";
+              if ($@) {
+                  print "Sputnik: Cannot find Mail::SpamAssassin perl module.\n\n".
+                      "You need to have this module installed in order to .\n".
+                      "test for spam.\n".
+                      die "\n";
+              }
+              my $mailitem = join("",@{$headeritmz});
+              my $SpamTest = Mail::SpamAssassin -> new();
+              my $MessageObject = $SpamTest -> check_message_text($mailitem);
+              my $SpamScore  = $MessageObject -> get_hits();
+              if ($SpamScore > $class->{config}{SPAMSCORE}) {
+                  push(@spam_msgz, $item);
+              } elsif ($SpamScore > $class->{config}{SUSPECTSPAMSCORE}) {
+                  push(@suspect_msgz, $item);
+              }
+            }
+           # Save downloaded message ID in the repository
+           print FILE $item."\n" or $class->die3("\nCannot write to REPOSITORY!!! Disk full?\n");
          }
        }
 
@@ -544,7 +571,38 @@
     else {
        print "Your ".@new_msgz." message(s) will be deleted!\n" if $class->{config}{DEBUG};
     }
+
+    ###
+    # SPAM MESSAGES
+    ###
+
+    # Move junk mail and suspected junk mail to appropriate places
+
+    print "Moving Spam messages around...\n" if $class->{config}{DEBUG};
+    my $folder = $class->{config}{SPAMFOLDER};
+    $folder =~ s/ /%20/g; # Convert any spaces in the name
+    my $what = "\/ym\/ShowFolder\?\.crumb=".$class->{config}{crumb}.
+        "\&MOV=1\&YY=".$YY.
+        "\&destBox=".$folder;
+    foreach my $item (@spam_msgz) {
+        $what = $what."\&Mid=".$item;
+    }
+    my $movepg = Page->new(\$class->{config}, \$class->{cookiez});
+    $movepg->load($host, $what);
 
+    $folder = $class->{config}{SUSPECTSPAMFOLDER};
+    $folder =~ s/ /%20/g; # Convert any spaces in the name
+    $what = "\/ym\/ShowFolder\?\.crumb=".$class->{config}{crumb}.
+        "\&MOV=1\&YY=".$YY.
+        "\&destBox=".$folder;
+    foreach my $item (@suspect_msgz) {
+        $what = $what."\&Mid=".$item;
+    }
+    $movepg = Page->new(\$class->{config}, \$class->{cookiez});
+    $movepg->load($host, $what);
+    print "Done moving spam...\n" if $class->{config}{DEBUG};
+
+
     ###
     # ERASE
     ##
@@ -615,6 +673,7 @@
   $self->{PROXY_PASS} = $$config->{PROXY_PASS};
   $self->{DEBUG} = $$config->{DEBUG};
   $self->{NOFROM} = $$config->{NOFROM};
+  $self->{NODOWNLOAD} = $$config->{NODOWNLOAD};
   $self->{lockfile} = $$config->{LOCKFILE};
   $self->{crumb} = \$$config->{crumb};
   $self->{warning} = \$$config->{warning};
@@ -1343,7 +1402,9 @@
        print "\bo" if $class->{DEBUG};                 # DEBUG
   }
 
-  print FILE @{$headeritmz} or Sucker::die3($class,"\nCannot write to OUTFILE!!! Disk full?\n");
+  if (! $class->{NODOWNLOAD}) {
+    print FILE @{$headeritmz} or Sucker::die3($class,"\nCannot write to OUTFILE!!! Disk full?\n");
+  }
   close(FILE);
 
   return $fetched;


--- YoSucker-pr29.orig/conf/sample1.conf        Sun May 11 19:44:26 2003
+++ YoSucker-pr29/conf/sample1.conf     Sun May 11 19:45:10 2003
 
 # Remove the "From " beginning of message delimiter (needed for some mail processing apps)
 # Leave commented or set to "0" unless you know EXACTLY what you're doin'!!!
@@ -126,3 +126,22 @@
 # all the other values will be ignored.
 CLEAN=0
 </Lethal>
+
+# SpamAssassin Options
+
+<SpamAssassin Options>
+# Use SpamAssassin
+USESA=1
+# Don't even bother downloading the mail,
+# just sort the spam out on the server
+NODOWNLOAD=1
+# Mail scoring above this is suspected spam
+SUSPECTSPAMSCORE=4.5
+# Where to put suspected spam
+SUSPECTSPAMFOLDER=Suspected Spam
+# Mail scoring above this is DEFINITELY spam
+SPAMSCORE=8
+# Where to put these obvious spam messages
+SPAMFOLDER=Spam
+</SpamAssassin>
+
