+ $this->_updateUnread($_nntp, $_since, $_display);
+ }
+
+ function _readFromFile()
+ {
+ $file = dirname(dirname(__FILE__))."/spool/spool-{$this->group}.dat";
+ if (file_exists($file)) {
+ $this = unserialize(file_get_contents($file));
+ }
+ }
+
+ function _saveToFile()
+ {
+ $file = dirname(dirname(__FILE__))."/spool/spool-{$this->group}.dat";
+ uasort($this->overview, "spoolcompare");
+
+ $this->roots = Array();
+ foreach($this->overview as $id=>$msg) {
+ if (is_null($msg->parent)) {
+ $this->roots[] = $id;
+ }
+ }
+
+ file_put_contents($file, serialize($this));
+ }
+
+ 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;