$mailboxes{$_} = 1 foreach keys %{$IMAP->{remote}->{mailboxes}};
my $sth_subscribe = $DBH->prepare(q{UPDATE mailboxes SET subscribed = ? WHERE idx = ?});
- @MAILBOXES = keys %mailboxes;
- @MAILBOXES = grep !/$CONF->{_}->{'ignore-mailbox'}/, @MAILBOXES
- if defined $CONF->{_}->{'ignore-mailbox'};
+ foreach my $mailbox (keys %mailboxes) {
+ next if defined $CONF->{_}->{'ignore-mailbox'} and $mailbox !~ /$CONF->{_}->{'ignore-mailbox'}/o;
+ my ($lExists, $rExists) = map {mbx_exists($_,$mailbox)} qw/local remote/;
+ next unless $lExists or $rExists;
- foreach my $mailbox (@MAILBOXES) {
check_delim($mailbox); # ensure that the delimiter match
- my ($lExists, $rExists) = map {mbx_exists($_,$mailbox)} qw/local remote/;
+ push $mailbox, @MAILBOXES;
$STH_GET_INDEX->execute($mailbox);
my ($idx,$subscribed) = $STH_GET_INDEX->fetchrow_array();