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/20 06:33:41 UTC

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

Author: felicity
Date: Thu Feb 19 21:33:39 2004
New Revision: 6789

Modified:
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
   incubator/spamassassin/trunk/masses/mass-check
   incubator/spamassassin/trunk/spamassassin.raw
Log:
make report_as_spam and revoke_as_spam deal with specificially the message passed in...  make sure when we call those functions that the message has SA markup removed.  do more calls to finish() to remove noticable memory leaks(), specifically when we do remove_spamassassin_markup...

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm	Thu Feb 19 21:33:39 2004
@@ -741,9 +741,6 @@
 
   $self->init(1);
 
-  # Let's make sure the markup was removed first ...
-  $mail = $self->parse ($self->remove_spamassassin_markup($mail));
-
   # learn as spam if enabled
   if ( $self->{conf}->{bayes_learn_during_report} ) {
     $self->learn ($mail, undef, 1, 0);
@@ -783,9 +780,6 @@
   local ($_);
 
   $self->init(1);
-
-  # Let's make sure the markup was removed first ...
-  $mail = $self->parse ($self->remove_spamassassin_markup($mail));
 
   # learn as nonspam
   $self->learn ($mail, undef, 0, 0);

Modified: incubator/spamassassin/trunk/masses/mass-check
==============================================================================
--- incubator/spamassassin/trunk/masses/mass-check	(original)
+++ incubator/spamassassin/trunk/masses/mass-check	Thu Feb 19 21:33:39 2004
@@ -246,7 +246,9 @@
   # remove SpamAssassin markup, if present and the mail was spam
   $_ = $ma->get_header ("X-Spam-Status");
   if (defined($_) && /^Yes,/) {
-    $ma = $spamtest->parse ($spamtest->remove_spamassassin_markup($ma));
+    my $new_ma = $spamtest->parse ($spamtest->remove_spamassassin_markup($ma));
+    $ma->finish();
+    $ma = $new_ma;
   }
 
   my $status = $spamtest->check($ma);

Modified: incubator/spamassassin/trunk/spamassassin.raw
==============================================================================
--- incubator/spamassassin/trunk/spamassassin.raw	(original)
+++ incubator/spamassassin/trunk/spamassassin.raw	Thu Feb 19 21:33:39 2004
@@ -182,12 +182,19 @@
       # go ahead and remove the markup, then fake that the clean version
       # was what was sent in
       #
-      $mail = $spamtest->parse ($spamtest->remove_spamassassin_markup ($mail));
+      my $new_mail = $spamtest->parse ($spamtest->remove_spamassassin_markup ($mail));
+      $mail->finish();
+      $mail = $new_mail;
     }
   }
 
 # handle unconditional reportage
   if ($opt{'report'}) {
+    # Make sure the message is clean first ...
+    my $new_mail = $spamtest->parse ($spamtest->remove_spamassassin_markup ($mail));
+    $mail->finish();
+    $mail = $new_mail;
+
     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";
     }
@@ -196,10 +203,15 @@
 
 # handle revoke
   if ($opt{'revoke'}) {
-      if ( $spamtest->revoke_as_spam ($mail) ) {
-          warn "Warning, unable to revoke spam\n";
-      }
-      exit(0);
+    # Make sure the message is clean first ...
+    my $new_mail = $spamtest->parse ($spamtest->remove_spamassassin_markup ($mail));
+    $mail->finish();
+    $mail = $new_mail;
+
+    if ( $spamtest->revoke_as_spam ($mail) ) {
+      warn "Warning, unable to revoke spam\nFor more information, re-run with -D option to see debug output.\n";
+    }
+    exit(0);
   }
 
   if ($@) { warn $@; }