test our new IP Parser ;)
[PHP-P10.git] / Bots / IPv6.class.php
index 9dc8f847bd55974b9a532063ffff067c588027cc..166dc8d5aa27f6f5df2db7c9d30191ab95bbea73 100644 (file)
@@ -39,8 +39,8 @@ class {$_NAME} extends Bot {
                if(!$old) {
                        $nick = "IPv6";
                        $ident = "ipv6";
-                       $ip = "0::0";
-                       $host = "fd00::C0CA:C01A:ADD5:11FE"; //coca cola adds life   maybe someone undestands it :D
+                       $ip = "fd00::C0CA:C01A:ADD5:11FE"; //coca cola adds life   maybe someone undestands it :D
+                       $host = $ip;
                        $realname = "IPv6";
                        $modes = "ioknISD";
                        $this->ipv6 = $this->uplink->addUser($nick,$ident,$host,$ip,$modes,$realname);
@@ -81,9 +81,7 @@ class {$_NAME} extends Bot {
        
        public function recive_join($user, $channel, $isBurst) {
                if(!$this->botOppedOnChannel($channel)) return false;
-               $ipv6 = '/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))(|\/[0-9]{1,3})$/';
-               echo $user->getIP()."\n";
-               if(preg_match($ipv6, $user->getIP())) {
+               if($user->getIP()->isIPv6()) {
                        $this->uplink->mode($this->ipv6, $channel, "+ov ".$user->getNumeric()." ".$user->getNumeric());
                } else {
                        $this->uplink->mode($this->ipv6, $channel, "+v ".$user->getNumeric());