- foreach ($msgids as $id=>$msgid) {
- $msg = new spoolhead($dates[$id], $subjects[$id], $froms[$id], 1);
- $refs[$id] = str_replace("><", "> <", $refs[$id]);
- $msgrefs = preg_split("/( |\t)/", strtr($refs[$id], $this->ids));
- $parents = preg_grep("/^\d+$/", $msgrefs);
- $msg->parent = array_pop($parents);
- $msg->parent_direct = preg_match("/^\d+$/", array_pop($msgrefs));
-
- $p = $msg->parent;
- while ($p) {
- if (isset($this->overview[$p])) {
- $this->overview[$p]->desc++;
- $p = $this->overview[$p]->parent;
- } else {
- $this->overview[$p] = new spoolhead($dates[$p], $subjects[$p], $froms[$p], 1);
- break;
- }
+ function _updateSpool(&$_nntp, $arg)
+ {
+ $dates = array_map(strtotime, $_nntp->xhdr("Date", $arg));
+ $subjects = array_map(headerdecode, $_nntp->xhdr("Subject", $arg));
+ $froms = array_map(headerdecode, $_nntp->xhdr("From", $arg));
+ $msgids = $_nntp->xhdr("Message-ID", $arg);
+ $refs = $_nntp->xhdr("References", $arg);
+
+ if (is_array($this->ids)) {
+ $this->ids = array_merge($this->ids, array_flip($msgids));
+ } else {
+ $this->ids = array_flip($msgids);
+ }
+
+ foreach ($msgids as $id=>$msgid) {
+ $msg = new spoolhead($dates[$id], $subjects[$id], $froms[$id]);
+ $refs[$id] = str_replace('><', '> <', $refs[$id]);
+ $msgrefs = preg_split("/[ \t]/", strtr($refs[$id], $this->ids));
+ $parents = preg_grep('/^\d+$/', $msgrefs);
+ $msg->parent = array_pop($parents);
+ $msg->parent_direct = preg_match('/^\d+$/', array_pop($msgrefs));
+
+ if (isset($this->overview[$id])) {
+ $msg->desc = $this->overview[$id]->desc;
+ $msg->children = $this->overview[$id]->children;
+ }
+ $this->overview[$id] = $msg;
+
+ if ($p = $msg->parent) {
+ if (empty($this->overview[$p])) {
+ $this->overview[$p] = new spoolhead($dates[$p], $subjects[$p], $froms[$p], 1);