X-Git-Url: http://git.pk910.de/?p=PHP-P10.git;a=blobdiff_plain;f=Bots%2FIPv6.class.php;fp=Bots%2FIPv6.class.php;h=d5c4a1ef2b4ea5ab6270b12dd37721fa453b71bc;hp=d30ee5398c7db3a55b353525ba620c6f59f96ec4;hb=7f51193ddac01b0540000c756c50167ff015e02a;hpb=811bc0c7a1f583fb624a0f8c3601146e063c5a25 diff --git a/Bots/IPv6.class.php b/Bots/IPv6.class.php index d30ee53..d5c4a1e 100644 --- a/Bots/IPv6.class.php +++ b/Bots/IPv6.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/IPv6.class.php * * IPv6 bot... @@ -27,10 +27,10 @@ class {$_NAME} extends Bot { private $uplink; private $ipv6; private $cache = array( - 0 => array(), - 1 => array() - ); - + 0 => array(), + 1 => array() + ); + public function load($uplink, $old = false) { $this->uplink = $uplink; if(!$old) { @@ -48,13 +48,13 @@ class {$_NAME} extends Bot { } else { $this->ipv6 = $old; } - + ModCMD::bind($this, BIND_JOIN, "recive_join"); ModCMD::bind($this, BIND_CHANMODE, "recive_mode"); ModCMD::bind($this, BIND_KICK, "recive_kick"); ModCMD::bind($this, BIND_QUIT, "recive_quit"); } - + public function unload($rehash = false) { if($rehash) { return $this->ipv6; @@ -62,7 +62,7 @@ class {$_NAME} extends Bot { $this->uplink->delUser($this->ipv6, "Bye."); } } - + public function loop() { for($i = 0; $i < 2; $i++) { foreach($this->cache[$i] as $id => $cache) { @@ -70,12 +70,12 @@ class {$_NAME} extends Bot { } } } - + private function botOppedOnChannel($channel) { $privs = $channel->getUserPrivs($this->ipv6); return ($privs & P10_Channel::USERPRIV_OPED); } - + public function recive_join($user, $channel, $isBurst) { if(!$this->botOppedOnChannel($channel)) return false; if($user->getIP()->isIPv6()) { @@ -84,7 +84,7 @@ class {$_NAME} extends Bot { $this->uplink->mode($this->ipv6, $channel, "+v ".$user->getNumeric()); } } - + public function recive_mode($user, $channel, $modes) { if($user->getModes()->hasMode('o') || !$this->botOppedOnChannel($channel)) return false; if(array_key_exists($user->getNumeric(), $this->cache[0]) && $this->cache[0][$user->getNumeric()]['time'] > time()) { @@ -110,7 +110,7 @@ class {$_NAME} extends Bot { $modes = implode(" ",$mode); $this->uplink->mode($this->ipv6, $channel, $modes); } - + public function recive_kick($user, $target, $channel, $modes) { if($user->getModes()->hasMode('o') || !$this->botOppedOnChannel($channel)) return false; if(array_key_exists($user->getNumeric(), $this->cache[1]) && $this->cache[1][$user->getNumeric()]['time'] > time()) { @@ -120,7 +120,7 @@ class {$_NAME} extends Bot { $this->cache[1][$user->getNumeric()] = time() + 600; } } - + public function recive_quit($user, $reason) { if($user === $this->ipv6) { $this->load($this->uplink);