diff options
Diffstat (limited to 'imapsync')
-rwxr-xr-x | imapsync | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -66,7 +66,11 @@ usage(1) if defined $COMMAND and (($COMMAND eq 'delete' and !@ARGV) or $COMMAND my $CONF = read_config( delete $CONFIG{config} // $NAME , [qw/_ local remote/] , database => qr/\A(\P{Control}+)\z/ - , logfile => qr/\A(\P{Control}+)\z/ ); + , logfile => qr/\A(\/\P{Control}+)\z/ + , 'list-mailbox' => qr/\A([\x01-\x09\x0B\x0C\x0E-\x7F]+)\z/ + , 'list-select-opts' => qr/\A([\x21\x23\x24\x26\x27\x2B-\x5B\x5E-\x7A\x7C-\x7E]+)\z/ + , 'ignore-mailbox' => qr/\A([\x01-\x09\x0B\x0C\x0E-\x7F]+)\z/ + ); my ($DBFILE, $LOCKFILE, $LOGGER_FD); { @@ -238,7 +242,8 @@ foreach my $name (qw/local remote/) { my $list = '"" '; my @params; if (!defined $COMMAND or $COMMAND eq 'repair') { - $list .= '"*"' unless @ARGV; + $list = '('.uc($CONF->{_}->{'list-select-opts'}).') '.$list if defined $CONF->{_}->{'list-select-opts'}; + $list .= (defined $CONF->{_}->{'list-mailbox'} ? '('.$CONF->{_}->{'list-mailbox'}.')' : '*') unless @ARGV; @params = ('SUBSCRIBED', 'STATUS (UIDVALIDITY UIDNEXT HIGHESTMODSEQ)'); } $list .= $#ARGV == 0 ? Net::IMAP::Sync::quote($ARGV[0]) @@ -404,6 +409,8 @@ my @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 (@MAILBOXES) { check_delim($mailbox); # ensure that the delimiter match |