diff options
-rwxr-xr-x | interimap | 4 | ||||
-rw-r--r-- | lib/Net/IMAP/InterIMAP.pm | 11 |
2 files changed, 3 insertions, 12 deletions
@@ -249,7 +249,7 @@ foreach my $name (qw/local remote/) { $config{enable} = 'QRESYNC'; $config{name} = $name; $config{'logger-fd'} = $LOGGER_FD if defined $LOGGER_FD; - $config{'compress'} //= ($name eq 'local' ? 'NO' : 'YES'); + $config{'compress'} //= ($name eq 'local' ? 0 : 1); $IMAP->{$name} = { client => Net::IMAP::InterIMAP::->new(%config) }; my $client = $IMAP->{$name}->{client}; @@ -514,7 +514,7 @@ sub sync_mailbox_list() { sync_mailbox_list(); ($lIMAP, $rIMAP) = map {$IMAP->{$_}->{client}} qw/local remote/; my $ATTRS = 'MODSEQ FLAGS INTERNALDATE '. - (((!defined $CONF->{_} or uc ($CONF->{_}->{'use-binary'} // 'YES') eq 'YES') and + (((!defined $CONF->{_} or $CONF->{_}->{'use-binary'} // 1) and !$lIMAP->incapable('BINARY') and !$rIMAP->incapable('BINARY')) ? 'BINARY' : 'BODY').'.PEEK[]'; diff --git a/lib/Net/IMAP/InterIMAP.pm b/lib/Net/IMAP/InterIMAP.pm index 65a0c10..678e09d 100644 --- a/lib/Net/IMAP/InterIMAP.pm +++ b/lib/Net/IMAP/InterIMAP.pm @@ -100,7 +100,7 @@ sub read_config($$%) { die "Invalid option $k\n" unless defined $opts{$k}; next unless defined $conf->{$k}; die "Invalid option $k = $conf->{$k}\n" unless $conf->{$k} =~ $opts{$k}; - $conf->{$k} = $1; + $conf->{$k} = $opts{$k} ne qr/\A(YES|NO)\z/i ? $1 : uc $1 eq 'YES' ? 1 : 0; } } return \%configs; @@ -221,15 +221,6 @@ sub new($%) { my $self = { @_ }; bless $self, $class; - foreach (keys %$self) { - next unless defined $self->{$_}; - if (uc $self->{$_} eq 'YES') { - $self->{$_} = 1; - } elsif (uc $self->{$_} eq 'NO') { - $self->{$_} = 0; - } - } - # the IMAP state: one of 'UNAUTH', 'AUTH', 'SELECTED' or 'LOGOUT' # (cf RFC 3501 section 3) $self->{_STATE} = ''; |