]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Msgmap.pm
nntp: simplify the long_response API
[public-inbox.git] / lib / PublicInbox / Msgmap.pm
index 26565d456b6c5d4b5d0ce320297dcb8e4ee5d7e2..c6a73155401b9bb3c1c6fd4c5adedddb79a01bbf 100644 (file)
@@ -196,6 +196,18 @@ ORDER BY num ASC LIMIT 1000
        $ids;
 }
 
+sub msg_range {
+       my ($self, $beg, $end) = @_;
+       my $dbh = $self->{dbh};
+       my $attr = { Columns => [] };
+       my $mids = $dbh->selectall_arrayref(<<'', $attr, $$beg, $end);
+SELECT num,mid FROM msgmap WHERE num >= ? AND num <= ?
+ORDER BY num ASC
+
+       $$beg = $mids->[-1]->[0] + 1 if @$mids;
+       $mids
+}
+
 # only used for mapping external serial numbers (e.g. articles from gmane)
 # see scripts/xhdr-num2mid or PublicInbox::Filter::RubyLang for usage
 sub mid_set {