[siesta-commit] siesta/lib/Siesta/Plugin Archive.pm,1.6,1.7 ListHeaders.pm,1.5,1.6 ReplyTo.pm,1.5,1.6 Send.pm,1.29,1.30 SubjectTag.pm,1.4,1.5 Subscribe.pm,1.15,1.16 UnSubscribe.pm,1.8,1.9

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

From: clampr
Subject: [siesta-commit] siesta/lib/Siesta/Plugin Archive.pm,1.6,1.7 ListHeaders.pm,1.5,1.6 ReplyTo.pm,1.5,1.6 Send.pm,1.29,1.30 SubjectTag.pm,1.4,1.5 Subscribe.pm,1.15,1.16 UnSubscribe.pm,1.8,1.9
Date: 20:16 on 15 Mar 2003
Update of /cvsroot/siesta/siesta/lib/Siesta/Plugin
In directory sc8-pr-cvs1:/tmp/cvs-serv10805/lib/Siesta/Plugin

Modified Files:
	Archive.pm ListHeaders.pm ReplyTo.pm Send.pm SubjectTag.pm 
	Subscribe.pm UnSubscribe.pm 
Log Message:
A metric ton of changes.

* All tables now have abstract id columns, so a users email address 
  is now $user->email and a lists name is $list->name

* Storage methods take ids, not objects

* User/List methods try to be a bit less magical/vaired about 
  what they take as parameters

Since modules and tests have been changed at the same time I expect 
there to be many bugs, but those'll be squished RSN


Index: Archive.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/Archive.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Archive.pm	12 Sep 2002 14:10:46 -0000	1.6
+++ Archive.pm	15 Mar 2003 20:15:45 -0000	1.7
@@ -15,7 +15,7 @@
     my $self = shift;
     my $mail = shift;
 
-    my $path = $Siesta::Config::ARCHIVE . "/" . $mail->list->id;
+    my $path = $Siesta::Config::ARCHIVE . "/" . $mail->list->name;
     eval {
         mkpath( [ map { "$path/$_" } qw( cur new tmp ) ], 0, 0777 );
     };

Index: ListHeaders.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/ListHeaders.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ListHeaders.pm	17 Sep 2002 11:30:18 -0000	1.5
+++ ListHeaders.pm	15 Mar 2003 20:15:46 -0000	1.6
@@ -10,7 +10,7 @@
     my $mail = shift;
 
     my $list         = $mail->list;
-    my $name         = $list->id;
+    my $name         = $list->name;
     my $post_address = $list->post_address;
     my $owner        = $list->owner;
     ( my $list_id       = $post_address ) =~ s/@/./;

Index: ReplyTo.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/ReplyTo.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ReplyTo.pm	17 Oct 2002 11:52:18 -0000	1.5
+++ ReplyTo.pm	15 Mar 2003 20:15:47 -0000	1.6
@@ -11,8 +11,8 @@
 #   http://www.metasystema.org/essays/reply-to-useful.mhtml
 #   http://thegestalt.org/simon/replytorant.html
 #   http://www.deez.info/sengelha/writings/considered-harmful/
-# for various for and against arguments thrashed out by the great 
-# and the good and for why I don't care. Feel free to argue about 
+# for various for and against arguments thrashed out by the great
+# and the good and for why I don't care. Feel free to argue about
 # this to your hearts content - the monkeys dance for my pleasure.
 #
 # DANCE MONKEYS! DANCE!
@@ -36,15 +36,13 @@
 sub options {
     return {
         'munge' => {
-            'description' =>
-              'should we munge the reply-to address of the message to be the list post',
-            'type'    => 'boolean',
-            'default' => 1,
-            'widget'  => 'checkbox',
-          }
-
-          };
-
+                    'description' =>
+                    'should we munge the reply-to address of the message to be the list post',
+                    'type'    => 'boolean',
+                    'default' => 1,
+                    'widget'  => 'checkbox',
+                   }
+           };
 }
 
 1;

Index: Send.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/Send.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- Send.pm	17 Sep 2002 11:31:54 -0000	1.29
+++ Send.pm	15 Mar 2003 20:15:47 -0000	1.30
@@ -14,10 +14,10 @@
 
     my $list = $mail->list;
     Siesta->sender->send(
-                          $mail,
-                          to   => [ map             { $_->id } $list->members ],
-                          from => $list->return_path
-                          );
+                         $mail,
+                         to   => [ map { $_->email } $list->members ],
+                         from => $list->return_path
+                        );
     return;
 }
 

Index: SubjectTag.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/SubjectTag.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- SubjectTag.pm	10 Sep 2002 18:24:20 -0000	1.4
+++ SubjectTag.pm	15 Mar 2003 20:15:48 -0000	1.5
@@ -10,7 +10,7 @@
     my $mail = shift;
 
     my $subject = $mail->subject || 'no subject';
-    my $list_name = $mail->list->id;
+    my $list_name = $mail->list->name;
     $mail->subject("[$list_name] $subject")
       unless $subject =~ /\[$list_name\]/;
     return;

Index: Subscribe.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/Subscribe.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Subscribe.pm	17 Oct 2002 11:52:18 -0000	1.15
+++ Subscribe.pm	15 Mar 2003 20:15:49 -0000	1.16
@@ -10,25 +10,77 @@
 $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 $user_id = $mail->from;
+    my $self   = shift;
+    my $mail   = shift;
+    my $list   = $mail->list;
+    my $email = $mail->from;
 
     # check to see if they're already subbed
-    if ( $list->is_member($user_id) ) {
+    if ( $list->is_member($email) ) {
         $self->already_subbed($mail);
         return 1;
     }
 
     # XXX should this be done implicitly by $list->add_member?
-    my $user = Siesta::User->new($user_id);
+    my $user = Siesta::User->new_from_email($email);
 
     unless ($user) {
-        $user = Siesta::User->new_from_hash( id => $user_id );
+        $user = Siesta::User->new_from_hash( email => $email );
         $user->save;
     }
 
+    # add the user to the list and if that fails, send an error
+    unless ( $list->add_member( $user ) ) {
+        # mail them and reject them
+        $self->already_subbed($mail);
+        return 1;
+    }
+
+    # mail the listowner and tell them that someone subbed
+    $mail->reply( to   => $list->owner,
+                  body => $user->email . "  JOIN " . $list->name );
+
+    # mail the person and tell them that they've been subbed
+    $mail->reply( body => <<END);
+Hi,
+ You have been successfully subscribed to ${ \( $list->name ) }
+
+Enjoy,
+- Siesta::Plugin::Subscribe
+END
+
+    return 1;
+}
+
+
+# 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->name ) }.
+
+Maybe you are already subscribed?  You might like to contact
+the list owner, ${ \( $list->owner ) }, for more assistance.
+
+Apologies,
+ - Siesta::Plugin::Subscribe
+END
+}
+
+
+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' );
@@ -170,5 +222,3 @@
 END
 
 }
-
-1;

Index: UnSubscribe.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Plugin/UnSubscribe.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- UnSubscribe.pm	17 Sep 2002 11:31:54 -0000	1.8
+++ UnSubscribe.pm	15 Mar 2003 20:15:50 -0000	1.9
@@ -13,14 +13,14 @@
     my $mail = shift;
     my $list = $mail->list;
 
-    my $user_id = $mail->from;
-    if ( $list->remove_member($user_id) ) {
+    my $email = $mail->from;
+    if ( $list->remove_member($email) ) {
         $mail->reply( to   => $list->owner,
-                      body => "$user_id LEFT " . $list->id );
+                      body => "$email LEFT " . $list->name );
 
         $mail->reply( body => <<END);
 Hi,
- You have been sucessfully unsubscribed from ${ \( $list->id ) }
+ You have been sucessfully unsubscribed from ${ \( $list->name ) }
 
 Come back soon,
 - Siesta::Plugin::UnSubscribe
@@ -28,13 +28,13 @@
     }
     else {
         $mail->reply( to   => $list->owner,
-                      body => "$user_id FAIL LEFT " . $list->id );
+                      body => "$email FAIL LEFT " . $list->name );
 
         $mail->reply( body => <<END);
 Hi,
- You could not be unsubscribed from ${ \( $list->id ) }
+ You could not be unsubscribed from ${ \( $list->name ) }
 
-Maybe you are not a member? You might like to contact 
+Maybe you are not a member? You might like to contact
 ${ \( $list->owner ) } for more assistance.
 
 Apologies,



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