- $lms->each_src($$uri, \&export_kw_imap, $self, $mic);
- $mic->expunge;
- } else { die "BUG: $input not supported" }
- $lms->lms_commit;
-}
-
-sub match_imap_url ($$) {
- my ($all, $url) = @_; # $all = [ $lms->folders ];
- require PublicInbox::URIimap;
- my $cli = PublicInbox::URIimap->new($url)->canonical;
- my ($s, $h, $mb) = ($cli->scheme, $cli->host, $cli->mailbox);
- my @uri = map { PublicInbox::URIimap->new($_)->canonical }
- grep(m!\A\Q$s\E://.*?\Q$h\E\b.*?/\Q$mb\E\b!, @$all);
- my @match;
- for my $x (@uri) {
- next if $x->mailbox ne $cli->mailbox;
- next if $x->host ne $cli->host;
- next if $x->port != $cli->port;
- my $x_uidval = $x->uidvalidity;
- next if ($cli->uidvalidity // $x_uidval) != $x_uidval;
-
- # allow nothing in CLI to possibly match ";AUTH=ANONYMOUS"
- if (defined($x->auth) && !defined($cli->auth) &&
- !defined($cli->user)) {
- push @match, $x;
- # or maybe user was forgotten on CLI:
- } elsif (defined($x->user) && !defined($cli->user)) {
- push @match, $x;
- } elsif (($x->user//"\0") eq ($cli->user//"\0")) {
- push @match, $x;
+ if ($mic && !$self->{nwr}->can_store_flags($mic)) {
+ my $m = "$input does not support PERMANENTFLAGS";
+ if (defined $self->{lei}->{opt}->{all}) {
+ $self->{lei}->qerr("# $m");
+ } else { # set error code if user explicitly requested
+ $self->{lei}->child_error(0, "E: $m");
+ }
+ return;