From f8387c281f2a73343fcca9e599d29bd93ece4524 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 8 Mar 2016 17:43:14 +0100 Subject: pullimap: improve doc. --- pullimap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pullimap') diff --git a/pullimap b/pullimap index 0e31a90..d2de66f 100755 --- a/pullimap +++ b/pullimap @@ -221,7 +221,7 @@ sub smtp_send(@) { $CONF->{'logger-fd'} = \*STDERR if $CONFIG{debug}; my $IMAP = do { my %config = (%$CONF, %CONFIG{qw/quiet debug/}, name => $ARGV[0]); - $config{keepalive} = 1 if defined $CONFIG{idle} and $config{type} ne 'tunnel'; + $config{keepalive} = 1 if defined $CONFIG{idle}; Net::IMAP::InterIMAP::->new( %config ); }; -- cgit v1.2.3 From 69e2f637222f81fd538809ef48f77d5334ef9c71 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 8 Mar 2016 17:49:47 +0100 Subject: pullimap: don't FETCH messages BODY if --no-delivery is set. --- pullimap | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pullimap') diff --git a/pullimap b/pullimap index d2de66f..c3fd4a0 100755 --- a/pullimap +++ b/pullimap @@ -254,7 +254,8 @@ sub purge() { # Use BODY.PEEK[] so if something gets wrong, unpulled messages # won't be marked as \Seen in the mailbox -my $ATTRS = "ENVELOPE INTERNALDATE BODY.PEEK[]"; +my $ATTRS = "ENVELOPE INTERNALDATE"; +$ATTRS .= " BODY.PEEK[]" unless $CONFIG{'no-delivery'}; # Pull new messages from IMAP and deliver them to SMTP, then update the # statefile @@ -265,7 +266,7 @@ sub pull(;$) { # invariant: we're at pos 8 + 4*(1+$#ignore + 1+$#uids) in the statefile $IMAP->pull_new_messages($ATTRS, sub($) { my $mail = shift; - return unless exists $mail->{RFC822}; # not for us + return unless exists $mail->{RFC822} or $CONFIG{'no-delivery'}; # not for us my $uid = $mail->{UID}; my $from = first { defined $_ and @$_ } @{$mail->{ENVELOPE}}[2,3,4]; -- cgit v1.2.3 From e19354c1b2b8015f58b7119763bb8cec401fb3fa Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 8 Mar 2016 18:02:10 +0100 Subject: pullimap: Don't rely on the last purged timestamp when purge-after=0. --- pullimap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pullimap') diff --git a/pullimap b/pullimap index c3fd4a0..c16d6ac 100755 --- a/pullimap +++ b/pullimap @@ -234,11 +234,11 @@ sub purge() { return unless 1<$uidnext; my $set = "1:".($uidnext-1); - my $now = time; - return if defined $LAST_PURGED and $now - $LAST_PURGED < 6*3600; - $LAST_PURGED = $now; - unless ($days == 0) { + my $now = time; + return if defined $LAST_PURGED and $now - $LAST_PURGED < 6*3600; # purge every 6h + $LAST_PURGED = $now; + my @now = gmtime($now - $days*86400); my @m = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/; # RFC 3501's date-month my $date = sprintf("%02d-%s-%04d", $now[3], $m[$now[4]], $now[5]+1900); -- cgit v1.2.3