Improve handling for multiline Newsgroups header.

This commit is contained in:
Retro_Guy 2024-05-27 05:57:59 -07:00
parent 2cba850cb0
commit a752d6537d
3 changed files with 15 additions and 1 deletions

View File

@ -356,6 +356,7 @@ function process_post($message, $group)
$body = "";
$ref = 0;
$sub = 0;
$ng = 0;
$response = "";
$bytes = 0;
$lines = 0;
@ -372,6 +373,7 @@ function process_post($message, $group)
if (strpos($line, ': ') !== false) {
$ref = 0;
$sub = 0;
$ng = 0;
}
if (stripos($line, "Path: ") === 0) {
$response = "441 Posting failed (Header preloading denied)\r\n";
@ -403,12 +405,16 @@ function process_post($message, $group)
if (stripos($line, "Newsgroups: ") === 0) {
$ngroups = explode(': ', $line);
$newsgroups = $ngroups[1];
$ng = 1;
}
if (stripos($line, "References: ") === 0) {
$references_line = explode(': ', $line);
$references = $references_line[1];
$ref = 1;
}
if (preg_match('/^\s/', $line) && $ng == 1) {
$newsgroups .= $newsgroups;
}
if (preg_match('/^\s/', $line) && $ref == 1) {
$references = $references . $line;
}

View File

@ -292,6 +292,7 @@ function get_articles($ns, $group)
$bytes = 0;
$ref = 0;
$sub = 0;
$ng = 0;
$banned = false;
$integrity = false;
$is_header = 1;
@ -312,6 +313,7 @@ function get_articles($ns, $group)
if (strpos($response, ': ') !== false) {
$ref = 0;
$sub = 0;
$ng = 0;
}
// Find article date
if (stripos($response, "Date: ") === 0) {
@ -372,6 +374,7 @@ function get_articles($ns, $group)
$current_article['xref'] .= ' ' . $agroup . ':' . $artnum;
}
}
$ng = 1;
}
if (stripos($response, "Xref: ") === 0) {
if (isset($CONFIG['enable_nntp']) && $CONFIG['enable_nntp'] == true) {
@ -388,6 +391,11 @@ function get_articles($ns, $group)
$references = $this_references[1];
$ref = 1;
}
if (preg_match('/^\s/', $response) && $ng == 1) {
$addgroups = preg_split("/\ |\,/", trim($response));
$allgroups = array_merge($allgroups, $addgroups);
}
if (preg_match('/^\s/', $response) && $ref == 1) {
$references = $references . $response;
}

View File

@ -1 +1 @@
0.9.87
0.9.875