[siesta-commit] siesta/lib/Siesta Message.pm,1.16,1.17

[prev] [thread] [next] [lurker] [Date index for 2002/09/13]

From: muttley
Subject: [siesta-commit] siesta/lib/Siesta Message.pm,1.16,1.17
Date: 21:50 on 13 Sep 2002
Update of /cvsroot/siesta/siesta/lib/Siesta
In directory usw-pr-cvs1:/tmp/cvs-serv3418/lib/Siesta

Modified Files:
	Message.pm 
Log Message:
Fix stuff. Add methods.


Index: Message.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Message.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Message.pm	10 Sep 2002 18:23:31 -0000	1.16
+++ Message.pm	13 Sep 2002 20:50:26 -0000	1.17
@@ -9,9 +9,27 @@
 
 use Class::MethodMaker get_set => [qw( list user)];
 
+# TODO tests for these
+sub to {
+   my $self = shift;
+   my $new  = shift;
+
+   if (defined $new) {
+	$self->head->replace('To', $new);
+   } 
+
+   Email::Valid->address($self->head->get('To') );
+}
+
 sub from {
     my $self = shift;
-    Email::Valid->address( $self->head->get('From') );
+    my $new  = shift;
+
+    if (defined $new) {
+        $self->head->replace('From', $new);
+    }
+ 
+   Email::Valid->address( $self->head->get('From') );
 }
 
 sub subject {
@@ -24,6 +42,37 @@
 
 sub reply {
 
+	my $self = shift;
+	my %args = @_;
+
+	if (defined $args{'body'})
+	{
+		my @body = split /\n/, $stuff{'body'};
+		$self->body(@body);
+	}
+
+	my $to   = $args{'from'} || $self->from();
+	my $from = $args{'to'}   || $self->to();
+
+	$self->to($to);
+	$self->from($from);
+
+	return $self->send();
+	
+
+}
+
+sub send {
+
+	return Siesta->sender->process($self, @_);
+}
+
+sub bounce {
+	my %args = @_;
+
+
+        my $to   = $args{'from'} || $self->from();
+	$self->send(to => $to);
 }
 
 1;



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