X-Git-Url: http://git.pk910.de/?p=PHP-P10.git;a=blobdiff_plain;f=Bots%2FPulseBot.class.php;fp=Bots%2FPulseBot.class.php;h=961d9747a6b7c0756bd7a42159aacf20f98a38b8;hp=b9a5e6a180544e5798a047be20fb0c47bb24329a;hb=7f51193ddac01b0540000c756c50167ff015e02a;hpb=811bc0c7a1f583fb624a0f8c3601146e063c5a25 diff --git a/Bots/PulseBot.class.php b/Bots/PulseBot.class.php index b9a5e6a..961d974 100644 --- a/Bots/PulseBot.class.php +++ b/Bots/PulseBot.class.php @@ -6,7 +6,7 @@ * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * - * * + * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * @@ -16,7 +16,7 @@ * along with this program. If not, see . * * * ************************************************************************ - * + * * Bots/PulseBot.class.php * * WhatPulse bot... @@ -28,9 +28,9 @@ class {$_NAME} extends Bot { private $pulsebot; private $cache = array(); private $db = array(); - + const TEAM_ID = 19418; - + public function load($uplink, $old = false) { $this->uplink = $uplink; if(!$old) { @@ -53,7 +53,7 @@ class {$_NAME} extends Bot { ModCMD::bind($this, BIND_JOIN, "recive_join"); ModCMD::bind($this, BIND_QUIT, "recive_quit"); } - + public function unload($rehash = false) { if($rehash) { return $this->pulsebot; @@ -61,15 +61,15 @@ class {$_NAME} extends Bot { $this->uplink->delUser($this->pulsebot, "Bye."); } } - + public function readDB($db) { $this->db = $db; } - + public function writeDB() { return $this->db; } - + private function getStats() { if(array_key_exists("stats", $this->cache) && time() - $this->cache['stats_time'] < 300) { //use cached stats @@ -82,7 +82,7 @@ class {$_NAME} extends Bot { } return $stats; } - + private function getUserStats($name) { if(array_key_exists("ustats_".strtolower($name), $this->cache) && time() - $this->cache['ustats_'.strtolower($name).'_time'] < 300) { //use cached stats @@ -102,12 +102,12 @@ class {$_NAME} extends Bot { } return null; } - + private function botOppedOnChannel($channel) { $privs = $channel->getUserPrivs($this->pulsebot); return ($privs & P10_Channel::USERPRIV_OPED); } - + function recive_privmsg($user, $channel, $message) { if(!$this->botOppedOnChannel($channel)) return; $privs = $channel->getUserPrivs($user); @@ -164,7 +164,7 @@ class {$_NAME} extends Bot { } } if(!$f) - $this->uplink->notice($this->pulsebot, $user, "WhatPulse user '".$exp[1]."' is not added."); + $this->uplink->notice($this->pulsebot, $user, "WhatPulse user '".$exp[1]."' is not added."); break; case ".users": $table = new Table(5); @@ -187,9 +187,9 @@ class {$_NAME} extends Bot { $lines = $table->end(); foreach($lines as $line) { if(count($exp) > 1) - $this->uplink->privmsg($this->pulsebot, $channel, $line); + $this->uplink->privmsg($this->pulsebot, $channel, $line); else - $this->uplink->notice($this->pulsebot, $user, $line); + $this->uplink->notice($this->pulsebot, $user, $line); } break; case ".mypulse": @@ -235,7 +235,7 @@ class {$_NAME} extends Bot { break; } } - + public function recive_join($user, $channel, $isBurst) { if(!$this->botOppedOnChannel($channel)) return false; if(!($auth = $user->getModes()->hasMode('r'))) return; @@ -262,7 +262,7 @@ class {$_NAME} extends Bot { $this->uplink->privmsg($this->pulsebot, $channel, "WhatPulse User \002".$pulseUser->MemberName."\002 (\002".number_format(floatval($pulseUser->MemberKeys),0,',','.')."\002 keys and \002".number_format(floatval($pulseUser->MemberClicks),0,',','.')."\002 clicks) has joined the channel."); } } - + public function recive_quit($user, $reason) { if($user === $this->pulsebot) { $this->load($this->uplink);