[siesta-commit] siesta/lib/Siesta/Plugin SubjectTag.pm,NONE,1.1 Archive.pm,1.3,1.4 CheckUser.pm,1.3,1.4 MembersOnly.pm,1.7,1.8 Send.pm,1.19,1.20 SimpleSig.pm,1.8,1.9 SpamAssassin.pm,1.2,1.3

[prev] [thread] [next] [lurker] [Date index for 2002/08/23]

From: clampr
Subject: [siesta-commit] siesta/lib/Siesta/Plugin SubjectTag.pm,NONE,1.1 Archive.pm,1.3,1.4 CheckUser.pm,1.3,1.4 MembersOnly.pm,1.7,1.8 Send.pm,1.19,1.20 SimpleSig.pm,1.8,1.9 SpamAssassin.pm,1.2,1.3
Date: 15:26 on 23 Aug 2002
Update of /cvsroot/siesta/siesta/lib/Siesta/Plugin
In directory usw-pr-cvs1:/tmp/cvs-serv4992/lib/Siesta/Plugin

Modified Files:
	Archive.pm CheckUser.pm MembersOnly.pm Send.pm SimpleSig.pm 
	SpamAssassin.pm 
Added Files:
	SubjectTag.pm 
Log Message:
change the Plugin->process api to simplify code

--- NEW FILE: SubjectTag.pm ---
package Siesta::Plugin::SubjectTag;
use strict;
use Siesta::Plugin;
use base 'Siesta::Plugin';
use vars qw( $DESCRIPTION );
$DESCRIPTION = 'add [list.id] to subject lines';

sub process {
    my $self = shift;
    my $mail = shift;

    my $subject   = $mail->head->get("Subject");
    my $list_name = $mail->list->id;
    $mail->head->replace("Subject", "[$list_name] $subject")
      unless $subject =~ /\[$list_name\]/;
    return;
}
1;
__END__

Index: Archive.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/Archive.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Archive.pm	22 Aug 2002 20:44:13 -0000	1.3
+++ Archive.pm	23 Aug 2002 14:26:38 -0000	1.4
@@ -12,11 +12,9 @@
 my $sequence = 0;
 sub process {
     my $self = shift;
-    my %args = @_;
-    my $mail = $args{mail};
-    my $list = $args{list};
+    my $mail = shift;
 
-    my $path = $Siesta::Config::ARCHIVE_PATH."/".$list->id;
+    my $path = $Siesta::Config::ARCHIVE_PATH . "/" . $mail->list->id;
     eval { mkpath( [ map { "$path/$_" } qw( cur new tmp ) ], 0, 0777 ) };
     my $now = time;
     $sequence++;

Index: CheckUser.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/CheckUser.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CheckUser.pm	21 Aug 2002 02:20:20 -0000	1.3
+++ CheckUser.pm	23 Aug 2002 14:26:38 -0000	1.4
@@ -15,11 +15,10 @@
 
 sub process  {
     my $self = shift;
-    my %args = @_;
-    my $mail = $args{'mail'};
+    my $mail = shift;
 
     # is it a valid email address?
-    return if check_email($mail->from);
+    return if check_email( $mail->from );
 
     # no, silently eat the message
     return 1;

Index: MembersOnly.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/MembersOnly.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- MembersOnly.pm	21 Aug 2002 13:29:36 -0000	1.7
+++ MembersOnly.pm	23 Aug 2002 14:26:38 -0000	1.8
@@ -8,11 +8,9 @@
 
 sub process {
     my $self = shift;
-    my %args = @_;
-    my $mail = $args{mail};
-    my $list = $args{list};
+    my $mail = shift;
 
-    return if $list->is_member( $mail->from );
+    return if $mail->list->is_member( $mail->from );
     # I'm not even supposed to be here today.
     $mail->reply("Hi,\n",
                  "Non-member posting is disabled for this list, and\n",

Index: Send.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/Send.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Send.pm	22 Aug 2002 21:50:27 -0000	1.19
+++ Send.pm	23 Aug 2002 14:26:38 -0000	1.20
@@ -10,9 +10,8 @@
 
 sub process {
     my $self = shift;
-    my %args = @_;
-    my $mail = $args{mail};
-    my $list = $args{list};
+    my $mail = shift;
+    my $list = $mail->list;
 
     # all of the following should probably be other plugins - Bounce,
     # ListID, SubjectTag.  something like that
@@ -24,10 +23,6 @@
     # observe RFC2919
     $post =~ s/@/./;
     $mail->head->add('List-Id', "$list_name list <$post>");
-
-    my $subject = $mail->head->get("Subject");
-    $mail->head->replace("Subject", "[$list_name] $subject")
-      unless $subject =~ /\[$list_name\]/;
 
     for my $user ($list->members) {
         my $address = $user->id;

Index: SimpleSig.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/SimpleSig.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- SimpleSig.pm	21 Aug 2002 16:49:03 -0000	1.8
+++ SimpleSig.pm	23 Aug 2002 14:26:38 -0000	1.9
@@ -9,9 +9,8 @@
 
 sub process {
     my $self = shift;
-    my %args = @_;
-    my $mail = $args{mail};
-    my $list = $args{list};
+    my $mail = shift;
+    my $list = $mail->list;
 
     # some sort of configuration lookup based on list and this plugin name,
     # however lets just say 5 instead

Index: SpamAssassin.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/SpamAssassin.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SpamAssassin.pm	21 Aug 2002 02:20:49 -0000	1.2
+++ SpamAssassin.pm	23 Aug 2002 14:26:38 -0000	1.3
@@ -15,8 +15,7 @@
 
 sub process {
     my $self = shift;
-    my %args = @_;
-    my $mail = $args{'mail'};
+    my $mail = shift;
 
     my $spamtest = Mail::SpamAssassin->new();
     my $status = $spamtest->check($mail);



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