Another year is about to end... So we have to update these damn copyright information :P
[PHP-P10.git] / Bots / IPv6.class.php
index 52fe7d1493f81b1ef1322e7dc760d3aa050874c5..d30ee5398c7db3a55b353525ba620c6f59f96ec4 100644 (file)
@@ -1,28 +1,25 @@
 <?php
-/********************************* PHP-P10 ******************************
- *    P10 uplink class by pk910   (c)2011 pk910                         *
- ************************************************************************
- *                          Version 2 (OOP)                             *
+/******************************* PHP-P10 v2 *****************************
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)                       *
  *                                                                      *
- * PHP-P10 is free software; you can redistribute it and/or modify      *
+ * This program is free software: you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or    *
+ * 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        *
  * GNU General Public License for more details.                         *
  *                                                                      *
  * You should have received a copy of the GNU General Public License    *
- * along with PHP-P10; if not, write to the Free Software Foundation,   *
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.       *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  *                                                                      *
  ************************************************************************
  * 
- *  Bots/ModManager.class.php
+ *  Bots/IPv6.class.php
  *
- * module manager bot...
+ * IPv6 bot...
  *
  */
 
@@ -39,7 +36,7 @@ class {$_NAME} extends Bot {
                if(!$old) {
                        $nick = "IPv6";
                        $ident = "ipv6";
-                       $ip = "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";
@@ -81,16 +78,9 @@ 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})$/';
-               if(preg_match($ipv6, $user->getIP())) {
-                       $privs = $channel->getUserPrivs($user);
-                       $privs |= (P10_Channel::USERPRIV_OPED | P10_Channel::USERPRIV_VOICE);
-                       $channel->setUserPrivs($user, $privs);
+               if($user->getIP()->isIPv6()) {
                        $this->uplink->mode($this->ipv6, $channel, "+ov ".$user->getNumeric()." ".$user->getNumeric());
                } else {
-                       $privs = $channel->getUserPrivs($user);
-                       $privs |= (P10_Channel::USERPRIV_VOICE);
-                       $channel->setUserPrivs($user, $privs);
                        $this->uplink->mode($this->ipv6, $channel, "+v ".$user->getNumeric());
                }
        }