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 | |
parent | 0955d3e95645b85fda791b2cef9c25684f7e1db4 (diff) |
pullimap: Remove "logfile" config option.
-rwxr-xr-x | interimap | 1 | ||||
-rw-r--r-- | lib/Net/IMAP/InterIMAP.pm | 1 | ||||
-rwxr-xr-x | pullimap | 20 |
3 files changed, 5 insertions, 17 deletions
@@ -72,6 +72,7 @@ die "Invalid mailbox name $_" foreach grep !/\A([\x01-\x7F]+)\z/, @ARGV; my $CONF = read_config( delete $CONFIG{config} // $NAME , [qw/_ local remote/] , database => qr/\A(\P{Control}+)\z/ + , logfile => qr/\A(\/\P{Control}+)\z/ , 'list-mailbox' => qr/\A([\x01-\x09\x0B\x0C\x0E-\x7F]+)\z/ , 'list-select-opts' => qr/\A([\x21\x23\x24\x26\x27\x2B-\x5B\x5E-\x7A\x7C-\x7E]+)\z/ , 'ignore-mailbox' => qr/\A([\x01-\x09\x0B\x0C\x0E-\x7F]+)\z/ diff --git a/lib/Net/IMAP/InterIMAP.pm b/lib/Net/IMAP/InterIMAP.pm index 0f674ac..efa6b92 100644 --- a/lib/Net/IMAP/InterIMAP.pm +++ b/lib/Net/IMAP/InterIMAP.pm @@ -59,7 +59,6 @@ my %OPTIONS = ( command => qr/\A(\P{Control}+)\z/, 'null-stderr' => qr/\A(YES|NO)\z/i, compress => qr/\A($RE_ATOM_CHAR+(?: $RE_ATOM_CHAR+)*)\z/, - logfile => qr/\A(\/\P{Control}+)\z/, SSL_protocols => qr/\A(!?$RE_SSL_PROTO(?: !?$RE_SSL_PROTO)*)\z/, SSL_fingerprint => qr/\A((?:[A-Za-z0-9]+\$)?\p{AHex}+)\z/, SSL_cipherlist => qr/\A(\P{Control}+)\z/, @@ -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 |