aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-06-12 22:27:32 +0200
committerGuilhem Moulin <guilhem@fripost.org>2016-06-12 22:27:32 +0200
commit5eb218879ba9ba7daa5e49ba4e3c0a690dc01e3b (patch)
treec90e9ccddc914e1df8dbc49338cb27d300abdb50
parent862d890b59e80997b84bca3f32099dadcd9d6622 (diff)
parent320a4da020952e3a8b926535d03d49a28dea20d0 (diff)
Merge branch 'master' into debian
-rwxr-xr-xinterimap2
-rw-r--r--interimap.md5
-rwxr-xr-xpullimap12
-rw-r--r--pullimap.md9
4 files changed, 20 insertions, 8 deletions
diff --git a/interimap b/interimap
index b714480..6396f8d 100755
--- a/interimap
+++ b/interimap
@@ -32,7 +32,7 @@ use List::Util 'first';
use Net::IMAP::InterIMAP qw/read_config compact_set/;
# Clean up PATH
-$ENV{PATH} = join ':', qw{/usr/local/bin /usr/bin /bin};
+$ENV{PATH} = join ':', qw{/usr/bin /bin};
delete @ENV{qw/IFS CDPATH ENV BASH_ENV/};
my %CONFIG;
diff --git a/interimap.md b/interimap.md
index 9d55d9e..7d119ab 100644
--- a/interimap.md
+++ b/interimap.md
@@ -375,8 +375,9 @@ Valid options are:
Supported extensions
====================
-Performance is better for servers supporting the following extensions to
-the [IMAP4rev1 protocol][RFC 3501]:
+`interimap` takes advantage of servers supporting the following
+extensions to the [IMAP4rev1 protocol][RFC 3501] (those marked as
+“recommended” give the most significant performance gain):
* `LITERAL+` ([RFC 2088], recommended);
* `MULTIAPPEND` ([RFC 3502], recommended);
diff --git a/pullimap b/pullimap
index 49fc837..1324228 100755
--- a/pullimap
+++ b/pullimap
@@ -32,6 +32,10 @@ use Socket qw/PF_INET PF_INET6 SOCK_STREAM/;
use Net::IMAP::InterIMAP qw/read_config compact_set/;
+# Clean up PATH
+$ENV{PATH} = join ':', qw{/usr/bin /bin};
+delete @ENV{qw/IFS CDPATH ENV BASH_ENV/};
+
my %CONFIG;
sub usage(;$) {
my $rv = shift // 0;
@@ -61,7 +65,7 @@ my $CONF = read_config( delete $CONFIG{config} // $NAME,
, 'deliver-method' => qr/\A([ls]mtp:\[.*\]:\d+)\z/
, 'deliver-ehlo' => qr/\A(\P{Control}+)\z/
, 'deliver-rcpt' => qr/\A(\P{Control}+)\z/
- , 'purge-after' => qr/\A(\d+)\z/
+ , 'purge-after' => qr/\A(\d*)\z/
)->{$ARGV[0]};
my ($MAILBOX, $STATE);
@@ -82,7 +86,9 @@ do {
}
sysopen($STATE, $statefile, O_CREAT|O_RDWR|O_DSYNC, 0600) or die "Can't open $statefile: $!";
- fcntl($STATE, F_SETLK, pack('sslll', F_WRLCK, SEEK_SET, 0, 0, $$)) or die "Can't lock $statefile: $!";
+ # XXX we need to pack the struct flock manually: not portable!
+ my $struct_flock = pack('s!s!l!l!i!', F_WRLCK, SEEK_SET, 0, 0, 0);
+ fcntl($STATE, F_SETLK, $struct_flock) or die "Can't lock $statefile: $!";
my $flags = fcntl($STATE, F_GETFD, 0) or die "fcntl F_GETFD: $!";
fcntl($STATE, F_SETFD, $flags | FD_CLOEXEC) or die "fcntl F_SETFD: $!";
};
@@ -231,7 +237,7 @@ my $LAST_PURGED;
sub purge() {
my $days = $CONF->{'purge-after'} // return;
my ($uidnext) = $IMAP->get_cache('UIDNEXT');
- return unless 1<$uidnext;
+ return unless $days ne '' and 1<$uidnext;
my $set = "1:".($uidnext-1);
unless ($days == 0) {
diff --git a/pullimap.md b/pullimap.md
index 244e7ac..5ff3af1 100644
--- a/pullimap.md
+++ b/pullimap.md
@@ -92,8 +92,9 @@ Valid options are:
*mailbox*
-: The IMAP mailbox to pull messages from. Support for persistent
- message Unique Identifiers (UID) is required. (Default: `INBOX`.)
+: The IMAP mailbox ([UTF-7 encoded][RFC 2152] and unquoted) to pull
+ messages from. Support for persistent message Unique Identifiers
+ (UID) is required. (Default: `INBOX`.)
*deliver-method*
@@ -314,6 +315,9 @@ Standards
[RFC 2033], October 1996.
* J. Myers, _IMAP4 non-synchronizing literals_,
[RFC 2088], January 1997.
+ * D. Goldsmith and M. Davis,
+ _A Mail-Safe Transformation Format of Unicode_,
+ [RFC 2152], May 1997.
* B. Leiba, _IMAP4 `IDLE` command_,
[RFC 2177], June 1997.
* C. Newman, _Using TLS with IMAP, POP3 and ACAP_,
@@ -337,6 +341,7 @@ Standards
[RFC 2177]: https://tools.ietf.org/html/rfc2177
[RFC 2595]: https://tools.ietf.org/html/rfc2595
[RFC 4959]: https://tools.ietf.org/html/rfc4959
+[RFC 2152]: https://tools.ietf.org/html/rfc2152
[RFC 2088]: https://tools.ietf.org/html/rfc2088
[RFC 5321]: https://tools.ietf.org/html/rfc5321
[RFC 2033]: https://tools.ietf.org/html/rfc2033