rev 1392 - in trunk/Siesta-Plugin-SpamAssassin: . lib/Siesta/Plugin t

[prev] [thread] [next] [lurker] [Date index for 2003/09/02]

From: richardc
Subject: rev 1392 - in trunk/Siesta-Plugin-SpamAssassin: . lib/Siesta/Plugin t
Date: 16:33 on 02 Sep 2003
Author: richardc
Date: 2003-09-02 16:33:22 +0100 (Tue, 02 Sep 2003)
New Revision: 1392

Added:
   trunk/Siesta-Plugin-SpamAssassin/t/
   trunk/Siesta-Plugin-SpamAssassin/t/SpamAssassin.t
Modified:
   trunk/Siesta-Plugin-SpamAssassin/Build.PL
   trunk/Siesta-Plugin-SpamAssassin/lib/Siesta/Plugin/SpamAssassin.pm
Log:
attempt to freshen

Modified: trunk/Siesta-Plugin-SpamAssassin/Build.PL
===================================================================
--- trunk/Siesta-Plugin-SpamAssassin/Build.PL	2003-09-02 14:19:41 UTC (rev 1391)
+++ trunk/Siesta-Plugin-SpamAssassin/Build.PL	2003-09-02 15:33:22 UTC (rev 1392)
@@ -6,6 +6,7 @@
          license     => 'perl',
          requires    => { 'Siesta' => '0.6',
                           'Mail::SpamAssassin' => 0,
+			  'Mail::Audit' => 0, # need to feed Mail::Audits to Mail::SpamAssassin
                         },
          sign => 1,
        )

Modified: trunk/Siesta-Plugin-SpamAssassin/lib/Siesta/Plugin/SpamAssassin.pm
===================================================================
--- trunk/Siesta-Plugin-SpamAssassin/lib/Siesta/Plugin/SpamAssassin.pm	2003-09-02 14:19:41 UTC (rev 1391)
+++ trunk/Siesta-Plugin-SpamAssassin/lib/Siesta/Plugin/SpamAssassin.pm	2003-09-02 15:33:22 UTC (rev 1392)
@@ -1,8 +1,5 @@
-# $Id: SpamAssassin.pm,v 1.1 2002/10/10 12:16:45 clampr Exp $
-package Siesta::Plugin::SpamAssassin;
-
-# standard includes
 use strict;
+package Siesta::Plugin::SpamAssassin;
 use Siesta::Plugin;
 use base 'Siesta::Plugin';
 
@@ -16,13 +13,15 @@
 
 # specific includes
 use Mail::SpamAssassin;
+use Mail::Audit;
 
 sub process {
     my $self = shift;
     my $mail = shift;
 
+    my $ma = Mail::Audit->new( data => [ split /\n/, $mail->as_string ] );
     my $spamtest = Mail::SpamAssassin->new();
-    my $status   = $spamtest->check($mail);
+    my $status   = $spamtest->check($ma);
 
     # Naughty person.
     return 1 if $status->is_spam();

Added: trunk/Siesta-Plugin-SpamAssassin/t/SpamAssassin.t
===================================================================
--- trunk/Siesta-Plugin-SpamAssassin/t/SpamAssassin.t	2003-09-02 14:19:41 UTC (rev 1391)
+++ trunk/Siesta-Plugin-SpamAssassin/t/SpamAssassin.t	2003-09-02 15:33:22 UTC (rev 1392)
@@ -0,0 +1,16 @@
+#!perl -w
+use Test::More tests => 1;
+use Siesta::Test init_db => 1;
+use Siesta;
+
+my $list = Siesta::List->new( name => "spamassassin-test" );
+ok( $list->set_plugins( post => 'SpamAssassin' ), 'set up the plugin' );
+
+open my $fh, 't/spam' or die "couldn't open sample spam";
+my $mail = Siesta::Message->new( join '', <$fh> );
+
+my ($plugin) = $list->plugins;
+ok( $plugin->process( $mail ), "stopped the spam" );
+
+
+$list->delete; # poof!

Generated at 13:57 on 01 Jul 2004 by mariachi 0.52