Fix References
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Sun, 28 Oct 2007 15:32:00 +0000 (15:32 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:35:52 +0000 (00:35 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@286 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/message.inc.php

index efe8f7a..8eba97a 100644 (file)
@@ -91,18 +91,12 @@ final class BananaMessage extends BananaMimePart
 
           case "references": case "in-reply-to":
             $rsl     = "";
-            $parents = preg_grep('/^\d+$/', $this->getTranslatedReferences());
-            $p       = array_pop($parents);
-
-            $parents = array();
-            while (!is_null($p)) {
-                array_unshift($parents, $p);
-                $p         = Banana::$spool->overview[$p]->parent;  
-            }
+            $parents = Banana::$spool->getReferences($this->headers);
             $ndx = 1;
-            foreach ($parents as $p) {
+            while (!empty($parents)) {
+                $p = array_shift($parents);
                 $rsl .= Banana::$page->makeLink(Array('group' => Banana::$spool->group,
-                                                      'artid' => $p, 'text' => $ndx++)) . ' ';
+                                                      'artid' => $p->id, 'text' => $ndx++)) . ' ';
             }
             return $rsl;
 
@@ -223,21 +217,6 @@ final class BananaMessage extends BananaMimePart
         return preg_split('/\s/', $text);
     }
 
-    public function getTranslatedReferences()
-    {
-        return BananaMessage::formatReferences($this->headers);
-    }
-
-    static public function &formatReferences(array &$refs)
-    {
-        $references = array();
-        $msgs = Banana::$spool->getReferences($refs);
-        foreach ($msgs as &$msg) {
-            $references[] = $msg->id;
-        }
-        return $references;
-    }
-
     public function hasXFace()
     {
         return Banana::$msgshow_xface &&