On Wed, 11 May 2005 20:05:30 -0700
David Sparks <[EMAIL PROTECTED]> wrote:
How about with this attached patch?
Brian
> I'm getting a warning on every message:
>
> Use of uninitialized value in array element at
> [...]lib/Qpsmtpd/Transaction.pm line 164.
>
> I actually don't use any plugins that run on the body. Perhaps
> _body_current_pos is being initialized by plugins that parse the body?
>
>
> --- Transaction.pm 2005-05-11 16:43:37.167427018 -0700
> +++ Transaction.pm.new 2005-05-11 19:57:40.299884709 -0700
> @@ -160,6 +160,7 @@
> }
> else {
> return unless $self->{_body_array};
> + $self->{_body_current_pos} ||= 0;
> my $line = $self->{_body_array}->[$self->{_body_current_pos}];
> $self->{_body_current_pos}++;
> return $line;
--- lib/Qpsmtpd/Transaction.pm 2005-05-05 03:32:02.000000000 -0600
+++ lib/Qpsmtpd/Transaction.pm 2005-05-05 03:32:07.000000000 -0600
@@ -64,6 +64,17 @@
sub set_body_start {
my $self = shift;
$self->{_body_start} = $self->body_current_pos;
+ if ($self->{_body_file}) {
+ $self->{_header_size} = $self->{_body_start};
+ }
+ else {
+ $self->{_header_size} = 0;
+ if ($self->{_body_array}) {
+ foreach my $line (@{ $self->{_body_array} }) {
+ $self->{_header_size} += length($line);
+ }
+ }
+ }
}
sub body_start {
@@ -123,6 +134,7 @@
foreach my $line (@{ $self->{_body_array} }) {
$self->{_body_file}->print($line) or die "Cannot print to temp file:
$!";
}
+ $self->{_body_start} = $self->{_header_size};
}
$self->{_body_array} = undef;
}
@@ -160,6 +172,7 @@
}
else {
return unless $self->{_body_array};
+ $self->{_body_current_pos} = 0 if !defined $self->{_body_current_pos};
my $line = $self->{_body_array}->[$self->{_body_current_pos}];
$self->{_body_current_pos}++;
return $line;