aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-03-08 18:02:10 +0100
committerGuilhem Moulin <guilhem@fripost.org>2016-03-08 18:02:10 +0100
commite19354c1b2b8015f58b7119763bb8cec401fb3fa (patch)
treedac3208b7e563a3176fdb937612b0d188b9c92ec
parent69e2f637222f81fd538809ef48f77d5334ef9c71 (diff)
pullimap: Don't rely on the last purged timestamp when purge-after=0.
-rwxr-xr-xpullimap8
-rw-r--r--pullimap.14
2 files changed, 7 insertions, 5 deletions
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);
diff --git a/pullimap.1 b/pullimap.1
index 746e2ff..57a4adf 100644
--- a/pullimap.1
+++ b/pullimap.1
@@ -114,7 +114,9 @@ Retention period (in days), after which messages are removed from the
IMAP server. (The value is at best 24h accurate due to IMAP SEARCH
criterion ignoring time and timezone.)
If \fIpurge\-after\fR is set to \(lq0\(rq then messages are deleted
-immediately after delivery.
+immediately after delivery. Otherwise \fBPullIMAP\fR issues an IMAP
+SEARCH command to list old messages; if \fB\-\-idle\fR is set then the
+SEARCH command is issued again every 6 hours.
.TP
.I type