diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2016-03-07 13:32:13 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2016-03-07 14:15:53 +0100 |
commit | 5d8b7a1bef1c1bb1a4efaeff9398f0ed81cb59b1 (patch) | |
tree | bf0e50dfeab30e7b395b62b0a47c43586c402bfe /pullimap | |
parent | 0955d3e95645b85fda791b2cef9c25684f7e1db4 (diff) |
pullimap: Remove "logfile" config option.
Diffstat (limited to 'pullimap')
-rwxr-xr-x | pullimap | 20 |
1 files changed, 4 insertions, 16 deletions
@@ -64,7 +64,7 @@ my $CONF = read_config( delete $CONFIG{config} // $NAME, , 'deliver-rcpt' => qr/\A(\P{Control}+)\z/ )->{$ARGV[0]}; -my ($MAILBOX, $STATE, $LOGGER_FD); +my ($MAILBOX, $STATE); do { $MAILBOX = $CONF->{mailbox} // 'INBOX'; @@ -86,19 +86,6 @@ do { fcntl($STATE, F_SETFL, $flags | FD_CLOEXEC) or die "fcntl F_SETFL: $!"; flock($STATE, LOCK_EX) or die "Can't flock $statefile: $!"; - - - if (defined (my $logfile = $CONF->{logfile})) { - require 'POSIX.pm'; - require 'Time/HiRes.pm'; - open $LOGGER_FD, '>>', $logfile or die "Can't open $logfile: $!\n"; - $LOGGER_FD->autoflush(1); - my $flags = fcntl($LOGGER_FD, F_GETFL, 0) or die "fcntl F_GETFL: $!"; - fcntl($LOGGER_FD, F_SETFL, $flags | FD_CLOEXEC) or die "fcntl F_SETFL: $!"; - } - elsif ($CONFIG{debug}) { - $LOGGER_FD = \*STDERR; - } }; @@ -230,11 +217,12 @@ sub smtp_send(@) { # Initialize the cache from the statefile, then pull new messages from # the remote mailbox # -my $IMAP = Net::IMAP::InterIMAP::->new( %$CONF, %CONFIG{qw/quiet debug/}, 'logger-fd' => $LOGGER_FD ); +$CONF->{'logger-fd'} = \*STDERR if $CONFIG{debug}; +my $IMAP = Net::IMAP::InterIMAP::->new( %$CONF, %CONFIG{qw/quiet debug/} ); # Use BODY.PEEK[] so if something gets wrong, unpulled messages # won't be marked as \Seen in the mailbox -my $ATTRS = join ' ', qw/ENVELOPE INTERNALDATE BODY.PEEK[]/; +my $ATTRS = "ENVELOPE INTERNALDATE BODY.PEEK[]"; # Pull new messages from IMAP and deliver them to SMTP, then update the # statefile |