Hi,
this patch adds two small functions to Qpsmtpd::Transaction.
- body_fh() returns the file handle for the temp file (if spooled to
disk) or undef (if not spooled to disk).
- body_length() - returns the current length of the body of the email
(including the empty line between header and body), no matter if
it's spooled to disk or not. This is not the same as body_size(),
which returns the size of the full message, as received by the
client.
Maybe it's useful for someone else :)
Hanno
--- ../qpsmtpd-0.3x/lib/Qpsmtpd/Transaction.pm 2006-08-06 17:57:37.000000000
+0200
+++ lib/Qpsmtpd/Transaction.pm 2006-12-05 18:18:22.486138219 +0100
@@ -160,6 +160,15 @@
1;
}
+sub body_length {
+ my $self = shift;
+ return $self->{_body_size} - $self->{_header_size};
+}
+
+sub body_fh {
+ return shift->{_body_file};
+}
+
sub body_getline {
my $self = shift;
if ($self->{_body_file}) {
@@ -304,6 +313,10 @@
Get the current size of the email.
+=head2 body_length( )
+
+Get the current size of the body of the mail.
+
=head2 body_resetpos( )
Resets the body filehandle to the start of the file (via C<seek()>).
@@ -316,6 +329,12 @@
Returns a single line of data from the body of the email.
+=head2 body_fh( )
+
+If the email is spooled to disk, it returns the file handle for the
+temporary file of the email, else it returns undef. To force spooling
+to disk, call I<body_filename()>.
+
=head1 SEE ALSO
L<Mail::Header>, L<Qpsmtpd::Address>, L<Qpsmtpd::Connection>