rev 1346 - trunk/siesta/lib/Siesta

[prev] [thread] [next] [lurker] [Date index for 2003/08/13]

From: richardc
Subject: rev 1346 - trunk/siesta/lib/Siesta
Date: 21:37 on 13 Aug 2003
Author: richardc
Date: 2003-08-13 21:37:52 +0100 (Wed, 13 Aug 2003)
New Revision: 1346

Modified:
   trunk/siesta/lib/Siesta/Message.pm
Log:
->reply is now more of a free thinker (don't clone everything from the message we're responding to)


Modified: trunk/siesta/lib/Siesta/Message.pm
===================================================================
--- trunk/siesta/lib/Siesta/Message.pm	2003-08-13 19:21:42 UTC (rev 1345)
+++ trunk/siesta/lib/Siesta/Message.pm	2003-08-13 20:37:52 UTC (rev 1346)
@@ -81,27 +81,17 @@
 sub reply {
     my $self  = shift;
     my %args  = @_;
-    my $clone = $self->clone;
 
-    if ( exists $args{body} ) {
-        $clone->body_set( $args{'body'} );
-    }
+    my $new = Siesta::Message->new;
+    $new->body_set( $args{body} || $self->body );
+    $new->header_set( 'To',          $args{to}      || $self->from );
+    $new->header_set( 'From',        $args{from}    || ( $self->to )[0] );
+    $new->header_set( 'Subject',     $args{subject} ||
+                        "Re: " . ( $self->subject || "Your mail" ) );
+    $new->header_set( 'In-Reply-To', $self->header( 'Message-Id' ) );
 
-    my $to   = $args{to}   || $self->from       or return;
-    my $from = $args{from} || ( $self->to )[0]  or return;
-
-    my $subject = $args{subject} || "Re: " . ( $self->subject || "Your mail" ) ;
-
-    $clone->header_set('To', $to);
-    $clone->header_set('From',$from);
-    $clone->header_set('Subject', $subject);
-
-    my $msg_id = $clone->header('Message-Id');
-    $clone->header_set('Message-Id', undef); # this relies on the MTA adding
-    $clone->header_set('In-Reply-To', $msg_id ) if $msg_id;
-
-    $clone->send;
-    Siesta->log("Message->reply sending" . $clone->as_string, 10);
+    $new->send;
+    Siesta->log("Message->reply sending" . $new->as_string, 10);
 }
 
 =head2 send

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