Improved article counting for group and listgroup commands

This commit is contained in:
Retro_Guy 2020-12-18 23:29:46 -07:00
parent 0ee48853a2
commit be067f78b9

View File

@ -716,9 +716,11 @@ function get_listgroup($nntp_group, $msgsock) {
$ok_article=array(); $ok_article=array();
while($line = fgets($group_overviewfp)) { while($line = fgets($group_overviewfp)) {
$art=explode("\t", $line); $art=explode("\t", $line);
if(is_numeric($art[0])) {
$ok_article[] = $art[0]; $ok_article[] = $art[0];
$count++; $count++;
} }
}
fclose($group_overviewfp); fclose($group_overviewfp);
sort($ok_article); sort($ok_article);
$last = $ok_article[key(array_slice($ok_article, -1, 1, true))]; $last = $ok_article[key(array_slice($ok_article, -1, 1, true))];
@ -755,9 +757,11 @@ function get_group($nntp_group) {
$ok_article=array(); $ok_article=array();
while($line = fgets($group_overviewfp)) { while($line = fgets($group_overviewfp)) {
$art=explode("\t", $line); $art=explode("\t", $line);
if(is_numeric($art[0])) {
$ok_article[] = $art[0]; $ok_article[] = $art[0];
$count++; $count++;
} }
}
fclose($group_overviewfp); fclose($group_overviewfp);
sort($ok_article); sort($ok_article);
$last = $ok_article[key(array_slice($ok_article, -1, 1, true))]; $last = $ok_article[key(array_slice($ok_article, -1, 1, true))];
@ -766,6 +770,7 @@ function get_group($nntp_group) {
$last = 0; $last = 0;
if(!is_numeric($first)) if(!is_numeric($first))
$first = 0; $first = 0;
// $count = ($last - $first) + 1;
$msg="211 ".$count." ".$first." ".$last." ".$nntp_group."\r\n"; $msg="211 ".$count." ".$first." ".$last." ".$nntp_group."\r\n";
return $msg; return $msg;
} }