summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-05-27 11:20:00 +0000
committerfukachan <fukachan>2002-05-27 11:20:00 +0000
commiteb03edfb8ba3028d1bc5db5e9aa5f4f7da40f9d5 (patch)
tree36b8671e6154b86d270e54717698760d99e4817e /fml/lib
parent47a3d3bd087c8d8b24dd6858c698abd2528271e3 (diff)
downloadfml8-eb03edfb8ba3028d1bc5db5e9aa5f4f7da40f9d5.tar.gz
fml8-eb03edfb8ba3028d1bc5db5e9aa5f4f7da40f9d5.tar.bz2
fml8-eb03edfb8ba3028d1bc5db5e9aa5f4f7da40f9d5.zip
pass smtp log file handle to Mail::Delivery
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/Mailer.pm6
-rw-r--r--fml/lib/FML/Process/Distribute.pm5
-rw-r--r--fml/lib/Mail/Delivery/SMTP.pm7
-rw-r--r--fml/lib/Mail/Delivery/Utils.pm13
4 files changed, 26 insertions, 5 deletions
diff --git a/fml/lib/FML/Mailer.pm b/fml/lib/FML/Mailer.pm
index af8f1a4a..273b384b 100644
--- a/fml/lib/FML/Mailer.pm
+++ b/fml/lib/FML/Mailer.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Mailer.pm,v 1.8 2001/12/23 11:39:44 fukachan Exp $
+# $FML: Mailer.pm,v 1.9 2002/05/22 15:59:57 fukachan Exp $
#
package FML::Mailer;
@@ -96,6 +96,7 @@ sub send
{
my ($self, $args) = @_;
my ($config, $maintainer, $fp, $sfp) = ();
+ my $handle = undef;
# $curproc is given in usual fml processes.
# but not in other programs.
@@ -105,11 +106,13 @@ sub send
$fp = sub { Log(@_);}; # pointer to the log function
$sfp = sub { my ($s) = @_; print $s; print "\n" if $s !~ /\n$/o;};
+ $handle = \*STDOUT;
my $curproc = $args->{ curproc };
my $wh = $curproc->open_outgoing_message_channel();
if (defined $wh) {
$sfp = sub { print $wh @_;};
+ $handle = $wh;
}
}
@@ -144,6 +147,7 @@ sub send
my $service = new Mail::Delivery {
log_function => $fp,
smtp_log_function => $sfp,
+ smtp_log_handle => $handle,
};
if ($service->error) { LogError($service->error); return 0;}
diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm
index 5e138590..3276c7d4 100644
--- a/fml/lib/FML/Process/Distribute.pm
+++ b/fml/lib/FML/Process/Distribute.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Distribute.pm,v 1.76 2002/05/21 15:07:31 fukachan Exp $
+# $FML: Distribute.pm,v 1.77 2002/05/27 08:51:13 fukachan Exp $
#
package FML::Process::Distribute;
@@ -389,10 +389,12 @@ sub _deliver_article
# distribute article
my $fp = sub { Log(@_);}; # pointer to the log function
my $sfp = sub { my ($s) = @_; print $s; print "\n" if $s !~ /\n$/o;};
+ my $handle = undef;
my $wh = $curproc->open_outgoing_message_channel();
if (defined $wh) {
$sfp = sub { print $wh @_;};
+ $handle = $wh;
}
if (0) { # debug
@@ -420,6 +422,7 @@ sub _deliver_article
$service = new Mail::Delivery {
log_function => $fp,
smtp_log_function => $sfp,
+ smtp_log_handle => $handle,
};
};
croak($@) if $@;
diff --git a/fml/lib/Mail/Delivery/SMTP.pm b/fml/lib/Mail/Delivery/SMTP.pm
index 9ac06b71..15e0d3df 100644
--- a/fml/lib/Mail/Delivery/SMTP.pm
+++ b/fml/lib/Mail/Delivery/SMTP.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: SMTP.pm,v 1.12 2002/01/16 13:34:03 fukachan Exp $
+# $FML: SMTP.pm,v 1.13 2002/01/27 13:11:57 fukachan Exp $
#
@@ -128,6 +128,7 @@ sub new
$me->{_default_io_timeout} = $args->{default_io_timeout} || 10;
$me->{_log_function} = $args->{log_function};
$me->{_smtp_log_function} = $args->{smtp_log_function};
+ $me->{_smtp_log_handle} = $args->{smtp_log_handle};
_initialize_delivery_session($me, $args);
@@ -759,6 +760,10 @@ sub _send_body_to_mta
$msg->set_log_function( $SmtpLogFunctionPointer );
$msg->set_print_mode('smtp');
$msg->print($socket);
+
+ if (defined $self->{ _smtp_log_handle }) {
+ $msg->print( $self->{ _smtp_log_handle });
+ }
}
diff --git a/fml/lib/Mail/Delivery/Utils.pm b/fml/lib/Mail/Delivery/Utils.pm
index b7407c5f..8c872383 100644
--- a/fml/lib/Mail/Delivery/Utils.pm
+++ b/fml/lib/Mail/Delivery/Utils.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Utils.pm,v 1.4 2001/12/22 09:21:17 fukachan Exp $
+# $FML: Utils.pm,v 1.5 2002/01/13 07:28:54 fukachan Exp $
#
package Mail::Delivery::Utils;
@@ -124,7 +124,16 @@ C<$buf> is sent to C<STDERR>.
sub smtplog
{
my ($self, $buf) = @_;
- _smtplog($buf);
+
+ if (defined $buf) {
+ if (defined $self->{ _smtp_log_handle }) {
+ my $wh = $self->{ _smtp_log_handle };
+ print $wh $buf;
+ }
+ else {
+ _smtplog($buf);
+ }
+ }
}