X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fnntp.inc.php;h=3b02c8626538118609f3120f9c738fea8cbe0385;hb=9bc195d617ee6d0b8428dc3458b07f6bab36f396;hp=1c5ce406019513c990e8bf313e449a6304d6b984;hpb=7972645bb364b21a1b23d8818bb1ca6f45d36d93;p=banana.git diff --git a/banana/nntp.inc.php b/banana/nntp.inc.php index 1c5ce40..3b02c86 100644 --- a/banana/nntp.inc.php +++ b/banana/nntp.inc.php @@ -99,13 +99,11 @@ class BananaNNTP extends BananaNNTPCore implements BananaProtocoleInterface /** Return a message * @param id Id of the emssage (can be either an Message-id or a message index) - * @param msg_headers Headers to process - * @param is_msgid If is set, $id is en Message-Id * @return A BananaMessage or null if the given id can't be retreived */ - public function getMessage($id, array $msg_headers = array(), $is_msgid = false) + public function &getMessage($id) { - if (!$is_msgid && Banana::$group != $this->ingroup) { + if (is_numeric($id) && Banana::$group != $this->ingroup) { if (is_null(Banana::$spool)) { $this->group(Banana::$group); $this->ingroup = Banana::$group; @@ -120,6 +118,25 @@ class BananaNNTP extends BananaNNTPCore implements BananaProtocoleInterface return null; } + /** Return the sources of the message + */ + public function getMessageSource($id) + { + if (is_numeric($id) && Banana::$group != $this->ingroup) { + if (is_null(Banana::$spool)) { + $this->group(Banana::$group); + $this->ingroup = Banana::$group; + } else { + $id = array_search($id, Banana::$spool->ids); + } + } + $data = $this->article($id); + if ($data !== false) { + return implode("\n", $data); + } + return null; + } + /** Return the indexes of the messages presents in the Box * @return Array(number of messages, MSGNUM of the first message, MSGNUM of the last message) */