]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiExportKw.pm
lei: simplify common LeiInput users with ->wq1_start
[public-inbox.git] / lib / PublicInbox / LeiExportKw.pm
index 5be9e51ff311c68e743d80480f9d12ef3d30c6e2..d2396fa7d697bb7b8b9ddf092ff27de65230f350 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;
@@ -114,13 +124,8 @@ EOM
                                        'imap_add_kw' : 'imap_set_kw');
                $self->{nwr}->{-skip_creat} = 1;
        }
-       my $ops = {};
-       $lei->{auth}->op_merge($ops, $self) if $lei->{auth};
-       (my $op_c, $ops) = $lei->workers_start($self, 1, $ops);
-       $lei->{wq1} = $self;
        $lei->{-err_type} = 'non-fatal';
-       net_merge_all_done($self) unless $lei->{auth};
-       $lei->wait_wq_events($op_c, $ops); # net_merge_all_done if !{auth}
+       $lei->wq1_start($self);
 }
 
 sub _complete_export_kw {