about summary refs log tree commit homepage
path: root/lib/PublicInbox/OverIdx.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/OverIdx.pm')
-rw-r--r--lib/PublicInbox/OverIdx.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm
index cc9bd7d4..bb3068dd 100644
--- a/lib/PublicInbox/OverIdx.pm
+++ b/lib/PublicInbox/OverIdx.pm
@@ -317,14 +317,21 @@ sub delete_articles {
         $self->delete_by_num($_) foreach @$nums;
 }
 
+# returns number of removed messages
+# $oid may be undef to match only on $mid
 sub remove_oid {
         my ($self, $oid, $mid) = @_;
+        my $nr = 0;
         $self->begin_lazy;
         each_by_mid($self, $mid, ['ddd'], sub {
                 my ($smsg) = @_;
-                $self->delete_by_num($smsg->{num}) if $smsg->{blob} eq $oid;
+                if (!defined($oid) || $smsg->{blob} eq $oid) {
+                        $self->delete_by_num($smsg->{num});
+                        $nr++;
+                }
                 1;
         });
+        $nr;
 }
 
 sub create_tables {