aboutsummaryrefslogtreecommitdiffstats
path: root/interimap
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-09-09 00:44:05 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-09-09 22:01:57 +0200
commit64dc8a1ed4e15ce456a699184a4fff263f2c902f (patch)
treed3e9f4c3a9167005b6b2d4035e7d348ed5043b2f /interimap
parent8c9328834e3340c1d3b20a5d9567fe8cd27f6d82 (diff)
Add support for the IMAP COMPRESS extension [RFC4978].
Also, add traffic statistics after closing the connection to the IMAP server.
Diffstat (limited to 'interimap')
-rwxr-xr-xinterimap12
1 files changed, 6 insertions, 6 deletions
diff --git a/interimap b/interimap
index af8b7fd..af2c510 100755
--- a/interimap
+++ b/interimap
@@ -109,7 +109,9 @@ my ($DBFILE, $LOCKFILE, $LOGGER_FD);
my $DBH;
# Clean after us
+my ($IMAP, $lIMAP, $rIMAP);
sub cleanup() {
+ undef $_ foreach grep defined, ($IMAP, $lIMAP, $rIMAP);
logger(undef, "Cleaning up...") if $CONFIG{debug};
unlink $LOCKFILE if defined $LOCKFILE and -f $LOCKFILE;
close $LOGGER_FD if defined $LOGGER_FD;
@@ -239,13 +241,13 @@ $LIST .= $#ARGV == 0 ? Net::IMAP::InterIMAP::quote($ARGV[0])
: ('('.join(' ',map {Net::IMAP::InterIMAP::quote($_)} @ARGV).')') if @ARGV;
-my $IMAP;
foreach my $name (qw/local remote/) {
my %config = %{$CONF->{$name}};
$config{$_} = $CONFIG{$_} foreach grep {defined $CONFIG{$_}} qw/quiet debug/;
$config{enable} = 'QRESYNC';
$config{name} = $name;
$config{'logger-fd'} = $LOGGER_FD if defined $LOGGER_FD;
+ $config{'compress'} //= ($name eq 'local' ? 'NO' : 'YES');
$IMAP->{$name} = { client => Net::IMAP::InterIMAP::->new(%config) };
my $client = $IMAP->{$name}->{client};
@@ -268,6 +270,7 @@ foreach my $name (qw/local remote/) {
@{$IMAP->{$_}}{qw/mailboxes delims/} = $IMAP->{$_}->{client}->list($LIST, @LIST_PARAMS) for qw/local remote/;
+
##############################################################################
#
@@ -507,7 +510,7 @@ sub sync_mailbox_list() {
}
sync_mailbox_list();
-my ($lIMAP, $rIMAP) = map {$IMAP->{$_}->{client}} qw/local remote/;
+($lIMAP, $rIMAP) = map {$IMAP->{$_}->{client}} qw/local remote/;
#############################################################################
@@ -1215,7 +1218,4 @@ while(1) {
sync_mailbox_list();
}
-END {
- $_->logout() foreach grep defined, ($lIMAP, $rIMAP);
- cleanup();
-}
+END { cleanup(); }