LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Mirco 'meebey' Bauer Date: Sun Jun 27 11:21:42 2004 Subject: cvs: pearbot /modules bugstats.php
meebey Sun Jun 27 13:21:42 2004 EDT
Modified files:
/pearbot/modules bugstats.php
Log:
- fixed update of current bugcount check.
http://cvs.php.net/diff.php/pearbot/modules/bugstats.php?r1=1.7&r2=1.8&ty=u
Index: pearbot/modules/bugstats.php
diff -u pearbot/modules/bugstats.php:1.7 pearbot/modules/bugstats.php:1.8
--- pearbot/modules/bugstats.php:1.7 Sun Jun 27 13:06:14 2004
+++ pearbot/modules/bugstats.php Sun Jun 27 13:21:42 2004
@@ -1,9 +1,9 @@
<?php
/**
- * $Id: bugstats.php,v 1.7 2004/06/27 17:06:14 meebey Exp $
- * $Revision: 1.7 $
+ * $Id: bugstats.php,v 1.8 2004/06/27 17:21:42 meebey Exp $
+ * $Revision: 1.8 $
* $Author: meebey $
- * $Date: 2004/06/27 17:06:14 $
+ * $Date: 2004/06/27 17:21:42 $
*
* Copyright (c) 2004 Tobias Schlitt <toby@php.net> & Mirco Bauer <meebey@php.net>
*/
@@ -26,7 +26,7 @@
function module_init(&$irc)
{
$this->actionids[] = $irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL|SMARTIRC_TYPE_QUERY|SMARTIRC_TYPE_NOTICE, '^!bugstats', $this, 'bugstats');
- $this->timeids[] = $irc->registerTimehandler($this->timeout, $this, 'autoBugstats');
+ $this->timeids[] = $irc->registerTimehandler($this->timeout, $this, 'updateTopic');
}
function module_exit(&$irc)
@@ -42,11 +42,9 @@
$count = $this->getStats();
if (PEAR::isError($count) || !$count) {
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, $count->getMessage());
- return false;
}
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, $data->nick.': Current bug count is '.$count);
$this->updateTopic($irc);
- return true;
}
function updateTopic(&$irc)
@@ -58,8 +56,10 @@
$chan = $irc->getChannel('#pear');
$topic = $chan->topic;
$topic = preg_replace('/[\| ]*[0-9]+ open bugs/isU', '', $topic);
- $irc->setTopic('#pear', $topic.' | '.$count.' open bugs');
- return true;
+ if ($this->lastCount != $count) {
+ $this->lastCount = $count;
+ $irc->setTopic('#pear', $topic.' | '.$count.' open bugs');
+ }
}
function getStats()
@@ -68,12 +68,7 @@
if (PEAR::isError($req->sendRequest())) {
return PEAR::raiseError('Error fetching bug stats.', 0);
}
- $data = (int)$req->getResponseBody();
- if ($this->lastCount != $data) {
- $this->lastCount = $data;
- return $data;
- }
- return false;
+ return (int)$req->getResponseBody();
}
}
?>
| Navigate in group php.pear.bot at sever news.php.net | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by Zareef Ahmed
Powered By PHP Consultants |