[siesta-commit] siesta/lib/Siesta/Plugin MembersOnly.pm,1.12,1.13 ReplyTo.pm,1.7,1.8 Subscribe.pm,1.18,1.19

[prev] [thread] [next] [lurker] [Date index for 2003/03/16]

From: clampr
Subject: [siesta-commit] siesta/lib/Siesta/Plugin MembersOnly.pm,1.12,1.13 ReplyTo.pm,1.7,1.8 Subscribe.pm,1.18,1.19
Date: 15:33 on 16 Mar 2003
Update of /cvsroot/siesta/siesta/lib/Siesta/Plugin
In directory sc8-pr-cvs1:/tmp/cvs-serv9132/lib/Siesta/Plugin

Modified Files:
	MembersOnly.pm ReplyTo.pm Subscribe.pm 
Log Message:
more defer hacking

Index: MembersOnly.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/MembersOnly.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- MembersOnly.pm	15 Sep 2002 11:34:06 -0000	1.12
+++ MembersOnly.pm	16 Mar 2003 15:33:04 -0000	1.13
@@ -9,21 +9,41 @@
 sub process {
     my $self = shift;
     my $mail = shift;
+    my $list = $mail->list;
 
-    return if $mail->list->is_member( $mail->from );
+    return if $list->is_member( $mail->from );
 
     # I'm not even supposed to be here today.
-    $mail->to( $mail->list->return_path );
+    my $extra = '';
+    if ($list->pref($self, 'approve')) {
+        $extra = "\nYour message is now held in an approval queue";
+        $mail->defer( for => "approve", from => $list->owner );
+    }
+
+    $mail->to( $list->return_path );
     $mail->reply( body => <<END);
 Hi,
 
 Non-member posting is disabled for this list, and you don't
-appear to be a subscriber
+appear to be a subscriber.
+$extra
 
 - Siesta::Plugin::MembersOnly
 END
 
     return 1;
+}
+
+sub options {
+    +{
+      'approve'
+      => {
+          description => "should we hold non-member posts for approval",
+          type        => "boolean",
+          default     => 1,
+          widget      => "checkbox",
+         },
+     };
 }
 
 1;

Index: ReplyTo.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/ReplyTo.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ReplyTo.pm	16 Mar 2003 13:10:36 -0000	1.7
+++ ReplyTo.pm	16 Mar 2003 15:33:04 -0000	1.8
@@ -20,14 +20,10 @@
 sub process {
     my $self = shift;
     my $mail = shift;
-    my $list = $mail->list || undef;
-
-    my $post_address = ( defined $list ) ? $mail->list->post_address : undef;
-    my $munge = $list->pref( $self, 'munge' );
-
-    $munge = ( defined $post_address ) ? $munge : 0;
+    my $list = $mail->list;
 
-    $mail->head->replace( 'Reply-To', $post_address ) if $munge;
+    $mail->head->replace( 'Reply-To', $list->post_address )
+      if $list->pref( $self, 'munge' );
 
     return;
 }

Index: Subscribe.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/Subscribe.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- Subscribe.pm	16 Mar 2003 13:10:36 -0000	1.18
+++ Subscribe.pm	16 Mar 2003 15:33:04 -0000	1.19
@@ -10,14 +10,15 @@
 $DESCRIPTION = 'A system plugin used for subscribing a member to the list';
 
 sub process {
-    my $self   = shift;
-    my $mail   = shift;
-    my $list   = $mail->list;
+    my $self  = shift;
+    my $mail  = shift;
+    my $list  = $mail->list;
     my $email = $mail->from;
 
     # check if this needs confirming
     if ( $list->pref($self, 'confirm') && ! $mail->confirmed ) {
-        $mail->defer( for => "confirm", from => "user" );
+        $mail->defer( for => "confirm", from => $mail->from );
+
         return 1;
     }
 
@@ -93,150 +94,3 @@
 
 1;
 
-__END__
-
-
-# all this stuff is too magical, and really buggers up the hacked over tests
-# --richardc 2003-03-15
-
-    # now check to see if there's a key for them
-    $mail->user($user);
-    my $value = $self->preference( $mail, 'request' );
-
-    # and get the value from subject
-    my ($sub) = $mail->subject =~ /SUBSCRIBE\s+(.+)/;
-
-    # if there is
-    if ( defined $sub ) {
-
-        # are they the same
-        if ( defined $value && ( $value eq $sub ) ) {
-
-            # tell them they've been subscribed
-            $self->successfully_subbed($mail);
-        }
-        elsif ( !( defined $value ) || !( $value eq $sub ) ) {
-
-            # tell them that their key is invalid
-            $self->invalid_key($mail);
-        }
-    }
-    else {
-
-        # send a key
-        $self->send_key($mail);
-    }
-
-    # now go through the database and remove any old keys
-    my $clone = $mail->clone;
-
-    # remove the user and the list so that
-    # we can clean as much up as possible
-    $clone->user(undef);
-    $clone->list(undef);
-
-    # get the time a month ago
-    my $date = time() - ( 60 * 60 * 24 * 31 );
-
-    # $self->delete_preference($clone, 'request', $date);
-    # TODO
-
-}
-
-# mail the person and the list owner and
-# tell them they've been subbed
-sub successfully_subbed {
-    my $self = shift;
-    my $mail = shift;
-    my $list = $mail->list;
-    my $user = $mail->user;
-
-    # delete the key already in the db
-    $self->delete_preference( $mail, 'request' );
-
-    # add the user to the list and if that fails, send an error
-    # TODO should this be a seperate send method?
-    unless ( $list->add_member( $user->id ) ) {
-        $self->already_subbed($mail);
-        return;
-    }
-
-    # mail the listowner and tell them that someone subbed
-    $mail->reply( to   => $list->owner,
-                  body => $user->id . "  JOIN " . $list->id );
-
-    # mail the person and tell them that they've been subbed
-    $mail->reply( body => <<END);
-Hi,
- You have been successfully subscribed to ${ \( $list->id ) }
-
-Enjoy,
-- Siesta::Plugin::Subscribe
-END
-
-}
-
-# Tell them they've already been subbed
-sub already_subbed {
-
-    my $self = shift;
-    my $mail = shift;
-    my $list = $mail->list;
-
-    # mail them and reject them
-    $mail->reply( body => <<END);
-Hi,
- You could not be subscribed to ${ \( $list->id ) }.
-
-Maybe you are already subscribed?  You might like to contact
-the list owner, ${ \( $list->owner ) }, for more assistance.
-
-Apologies,
- - Siesta::Plugin::Subscribe
-END
-}
-
-# Tell them that the key they passed was invalid
-sub invalid_key {
-    my $self = shift;
-    my $mail = shift;
-    my $list = $mail->list;
-
-    # mail them and reject them
-    $mail->reply( body => <<END);
-Hi,
- You could not be subscribed to ${ \( $list->id ) }.
-
- The subscribe key you gave was invalid.
-
-Apologies,
- - Siesta::Plugin::Subscribe
-END
-}
-
-# send them a unique key
-sub send_key {
-    my $self = shift;
-    my $mail = shift;
-    my $list = $mail->list;
-
-    # generate a unique value
-    my $value = md5_hex( $$ . time() . {} . rand() );
-    $self->preference( $mail, 'request', $value );
-
-    # mail them with a a request
-    $mail->subject("SUBSCRIBE $value");
-    $mail->reply( body => <<END);
-Hi,
- You have requested to be subscribed to  ${ \( $list->id ) }.
-
- Please reply to this mail with the subject line
-
- SUBSCRIBE $value
-
- Hitting 'reply' in most mail clients should suffice.
-
- - Siesta::Plugin::Subscribe
-END
-
-}



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