You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2004/02/17 04:16:52 UTC

svn commit: rev 6700 - in incubator/spamassassin/trunk: . lib/Mail

Author: felicity
Date: Mon Feb 16 19:16:51 2004
New Revision: 6700

Modified:
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
   incubator/spamassassin/trunk/spamassassin.raw
Log:
bug 1971: 'spamassassin -d -t' used to only remove the markup of the input mail, but will now remove the markup and run through -t as usual.  also got rid of the calls to MsgContainer->ignore() from spamassassin and replaced with a simple exit() command.  also found that -d wasn't working correctly due to the new API so that's fixed. :)

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm	Mon Feb 16 19:16:51 2004
@@ -902,7 +902,7 @@
     }
   }
 
-  my $hdrs = $mail_obj->get_all_headers();
+  my $hdrs = $mail_obj->get_pristine_header();
 
   # remove DOS line endings
   $hdrs =~ s/\r//gs;
@@ -979,7 +979,7 @@
     }
   }
 
-  return $hdrs."\n".join ('', @newbody);
+  return $hdrs.join ('', @newbody);
 }
 
 ###########################################################################

Modified: incubator/spamassassin/trunk/spamassassin.raw
==============================================================================
--- incubator/spamassassin/trunk/spamassassin.raw	(original)
+++ incubator/spamassassin/trunk/spamassassin.raw	Mon Feb 16 19:16:51 2004
@@ -173,8 +173,18 @@
 
 # handle removing reports
   if ($opt{'remove-markup'}) {
-    print $spamtest->remove_spamassassin_markup ($mail);
-    $mail->ignore();		# will exit
+    # If we're not going to retest, just remove the markup and print it out
+    if (!$opt{'test-mode'}) {
+      print $spamtest->remove_spamassassin_markup ($mail);
+      exit(0);
+    }
+    else {
+      # remove the markup and retest it...  a little more tricky ...
+      # go ahead and remove the markup, then fake that the clean version
+      # was what was sent in
+      #
+      $mail = Mail::SpamAssassin::MsgParser->parse ($spamtest->remove_spamassassin_markup ($mail));
+    }
   }
 
 # handle unconditional reportage
@@ -182,7 +192,7 @@
     if ( $spamtest->report_as_spam ($mail) ) {
       warn "Warning, unable to report spam\nFor more information, re-run with -D option to see debug output.\n";
     }
-    $mail->ignore();		# will exit
+    exit(0);
   }
 
 # handle revoke
@@ -190,7 +200,7 @@
       if ( $spamtest->revoke_as_spam ($mail) ) {
           warn "Warning, unable to revoke spam\n";
       }
-      $mail->ignore();          # will exit
+      exit(0);
   }
 
   if ($@) { warn $@; }
@@ -219,7 +229,7 @@
     }
 
     # don't need to log here -- it's already been done
-    $mail->ignore();		# will exit
+    exit(0);
   }
 
   # not reporting? OK, do checks instead.  Create a status object which