aboutsummaryrefslogtreecommitdiffstats
path: root/imapsync
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-07-30 00:57:14 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-07-30 01:27:04 +0200
commit0c1aa3921e1736ab29caa9b77e62446c40d9214a (patch)
treee5ac75313d5b819257c260a7fbef73721daea0c8 /imapsync
parentd1c7440ee9c925e036472044c74b3b8d9268cd99 (diff)
Ignore mailboxes with '\NoSelect' attribute.
Diffstat (limited to 'imapsync')
-rwxr-xr-ximapsync16
1 files changed, 11 insertions, 5 deletions
diff --git a/imapsync b/imapsync
index ae6bc79..9bcc7b5 100755
--- a/imapsync
+++ b/imapsync
@@ -280,15 +280,15 @@ sub check_delim($) {
# Return true if $mailbox exists on $name
sub mbx_exists($$) {
my ($name, $mailbox) = @_;
- my $flags = $IMAP->{$name}->{mailboxes}->{$mailbox};
- return (defined $flags and !grep {lc $_ eq lc '\NonExistent'} @$flags) ? 1 : 0;
+ my $attrs = $IMAP->{$name}->{mailboxes}->{$mailbox};
+ return (defined $attrs and !grep {lc $_ eq lc '\NonExistent'} @$attrs) ? 1 : 0;
}
# Return true if $mailbox is subscribed to on $name
sub mbx_subscribed($$) {
my ($name, $mailbox) = @_;
- my $flags = $IMAP->{$name}->{mailboxes}->{$mailbox};
- return (defined $flags and grep {lc $_ eq lc '\Subscribed'} @$flags) ? 1 : 0;
+ my $attrs = $IMAP->{$name}->{mailboxes}->{$mailbox};
+ return (defined $attrs and grep {lc $_ eq lc '\Subscribed'} @$attrs) ? 1 : 0;
}
@@ -413,8 +413,14 @@ my @MAILBOXES;
my ($lExists, $rExists) = map {mbx_exists($_,$mailbox)} qw/local remote/;
next unless $lExists or $rExists;
+ my @attrs = do {
+ my %attrs = map {$_ => 1} (@{$IMAP->{local}->{mailboxes}->{$mailbox} // []},
+ @{$IMAP->{remote}->{mailboxes}->{$mailbox} // []});
+ keys %attrs;
+ };
+
check_delim($mailbox); # ensure that the delimiter match
- push @MAILBOXES, $mailbox;
+ push @MAILBOXES, $mailbox unless grep {lc $_ eq lc '\NoSelect'} @attrs;
$STH_GET_INDEX->execute($mailbox);
my ($idx,$subscribed) = $STH_GET_INDEX->fetchrow_array();