cvs: pearbot /modules bugstats.php

From: Date: Sat, 26 Jun 2004 19:50:02 +0000
Subject: cvs: pearbot /modules bugstats.php
Groups: php.pear.bot 
Request: Send a blank email to pear-bot+get-44@lists.php.net to get a copy of this message
toby Sat Jun 26 15:50:02 2004 EDT Modified files: /pearbot/modules bugstats.php Log: * Topic update only when bugcount changed. http://cvs.php.net/diff.php/pearbot/modules/bugstats.php?r1=1.3&r2=1.4&ty=u Index: pearbot/modules/bugstats.php diff -u pearbot/modules/bugstats.php:1.3 pearbot/modules/bugstats.php:1.4 --- pearbot/modules/bugstats.php:1.3 Sat Jun 26 07:40:57 2004 +++ pearbot/modules/bugstats.php Sat Jun 26 15:50:02 2004 @@ -1,9 +1,9 @@ <?php /** - * $Id: bugstats.php,v 1.3 2004/06/26 11:40:57 toby Exp $ - * $Revision: 1.3 $ + * $Id: bugstats.php,v 1.4 2004/06/26 19:50:02 toby Exp $ + * $Revision: 1.4 $ * $Author: toby $ - * $Date: 2004/06/26 11:40:57 $ + * $Date: 2004/06/26 19:50:02 $ * * Copyright (c) 2004 Tobias Schlitt <toby@php.net> & Mirco Bauer <meebey@php.net> */ @@ -16,6 +16,8 @@ var $description = '!bugstats command'; var $author = 'Tobias Schlitt <toby@php.net> & Mirco Bauer <meebey@php.net>'; var $license = 'LGPL'; + + var $lastCount = 0; var $timeids = array(); var $actionids = array(); @@ -37,7 +39,7 @@ function bugstats(&$irc, &$data) { $count = $this->getStats(); - if (PEAR::isError($count)) { + if (PEAR::isError($count) || !$count) { $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, $count->getMessage()); return $count; } @@ -48,7 +50,7 @@ function autoBugstats (&$irc) { $count = $this->getStats(); - if (PEAR::isError($count)) { + if (PEAR::isError($count) || !$count) { return $count; } $chan = $irc->getChannel('#pear'); @@ -63,7 +65,12 @@ if (PEAR::isError($req->sendRequest())) { return PEAR::raiseError('Error fetching bug stats.', 0); } - return $req->getResponseBody(); + $data = (int)$req->getResponseBody(); + if ($this->lastCount =! $data) { + $this->lastCount = $data; + return $data; + } + return false; } } ?>

« previous php.pear.bot (#44) next »