. * * @category Notice stream * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ if (!defined('STATUSNET')) { // This check helps protect against security problems; // your code file can't be executed directly from the web. exit(1); } /** * This notice stream filters notices by whether their conversation * has been seen before. It's a good (well, OK) way to get streams * for a ThreadedNoticeList display. * * @category Notice stream * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ class ThreadingNoticeStream extends FilteringNoticeStream { protected $seen = array(); function getNotices($offset, $limit, $sinceId=null, $maxId=null) { // Clear this each time we're called $this->seen = array(); return parent::getNotices($offset, $limit, $sinceId, $maxId); } function filter($notice) { if (!array_key_exists($notice->conversation, $this->seen)) { $this->seen[$notice->conversation] = true; return true; } else { return false; } } }