]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiExportKw.pm
lei export-kw: skip read-only IMAP folders
[public-inbox.git] / lib / PublicInbox / LeiExportKw.pm
index 5be9e51ff311c68e743d80480f9d12ef3d30c6e2..0ecfb7829772b68875c579c6c9901ba1d34b2610 100644 (file)
@@ -67,7 +67,17 @@ sub input_path_url {
                $self->{lms}->each_src($input, \&export_kw_md, $self, $mdir);
        } elsif ($input =~ m!\Aimaps?://!i) {
                my $uri = PublicInbox::URIimap->new($input);
-               if (my $mic = $self->{nwr}->mic_for_folder($uri)) {
+               my $mic = $self->{nwr}->mic_for_folder($uri);
+               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;
+               }
+               if ($mic) {
                        $self->{lms}->each_src($$uri, \&export_kw_imap,
                                                $self, $mic);
                        $mic->expunge;
@@ -115,7 +125,7 @@ EOM
                $self->{nwr}->{-skip_creat} = 1;
        }
        my $ops = {};
-       $lei->{auth}->op_merge($ops, $self) if $lei->{auth};
+       $lei->{auth}->op_merge($ops, $self, $lei) if $lei->{auth};
        (my $op_c, $ops) = $lei->workers_start($self, 1, $ops);
        $lei->{wq1} = $self;
        $lei->{-err_type} = 'non-fatal';