Ask Bj�rn Hansen wrote:
Mucking with the "internals" of the transaction object without going through the API is evil. :-) (but that's an easy fix).

Sorry, is this better?

John
? META.yml
? Makefile
? blib
? pm_to_blib
? update.diff
Index: lib/Qpsmtpd/SMTP.pm
===================================================================
RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/SMTP.pm,v
retrieving revision 1.50
diff -u -r1.50 SMTP.pm
--- lib/Qpsmtpd/SMTP.pm 25 Feb 2005 16:18:08 -0000      1.50
+++ lib/Qpsmtpd/SMTP.pm 1 Mar 2005 00:23:31 -0000
@@ -471,15 +471,19 @@
         # FIXME - call plugins to work on just the header here; can
         # save us buffering the mail content.
 
+       # Save the start of just the body itself        
+       $self->transaction->body_start($size);
+
       }
 
+      # grab a copy of all of the header lines
       if ($in_header) {
         $buffer .= $_;  
       }
-      else {
-        $self->transaction->body_write($_);
-      }
 
+      # copy all lines into the spool file, including the headers
+      # we will create a new header later before sending onwards
+      $self->transaction->body_write($_);
       $size += length $_;
     }
     #$self->log(LOGDEBUG, "size is at $size\n") unless ($i % 300);
Index: lib/Qpsmtpd/Transaction.pm
===================================================================
RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/Transaction.pm,v
retrieving revision 1.19
diff -u -r1.19 Transaction.pm
--- lib/Qpsmtpd/Transaction.pm  22 Feb 2005 02:47:39 -0000      1.19
+++ lib/Qpsmtpd/Transaction.pm  1 Mar 2005 00:23:31 -0000
@@ -57,6 +57,12 @@
   $self->{_notes}->{$key};
 }
 
+sub body_start {
+  my $self = shift;
+  @_ and $self->{_body_start} = shift;
+  $self->{_body_start};
+}
+
 sub body_filename {
   my $self = shift;
   return unless $self->{_body_file};
@@ -86,7 +92,8 @@
 sub body_resetpos {
   my $self = shift;
   return unless $self->{_body_file};
-  seek($self->{_body_file}, 0,0);
+  my $start = $self->{_body_start} || 0;
+  seek($self->{_body_file}, $start, 0);
   $self->{_body_file_writing} = 0;
   1;
 }
@@ -94,7 +101,8 @@
 sub body_getline {
   my $self = shift;
   return unless $self->{_body_file};
-  seek($self->{_body_file}, 0,0)
+  my $start = $self->{_body_start} || 0;
+  seek($self->{_body_file}, $start,0)
     if $self->{_body_file_writing};
   $self->{_body_file_writing} = 0;
   my $line = $self->{_body_file}->getline;

Reply via email to