format
[PHP-P10.git] / Bots / ModManager.class.php
index a83e0a8b1e2ac2837e7e8bac9322ef832c3302b7..38281f40c584b71f8298ca011e7312d7215d29e5 100644 (file)
@@ -1,12 +1,10 @@
 <?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,      *
  * 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
  *
  * module manager bot...
@@ -29,7 +26,7 @@
 class {$_NAME} extends Bot {
        private $uplink;
        private $modman;
-       
+
        public function load($uplink, $old = false) {
                $this->uplink = $uplink;
                if(!$old) {
@@ -47,11 +44,12 @@ class {$_NAME} extends Bot {
                } else {
                        $this->modman = $old;
                }
-               
+
                ModCMD::bind($this, BIND_CHANMSG, "recive_privmsg");
                ModCMD::bind($this, BIND_QUIT, "recive_quit");
+               ModCMD::bind($this, BIND_CTCP, "recive_ctcp");
        }
-       
+
        public function unload($rehash = false) {
                if($rehash) {
                        return $this->modman;
@@ -59,8 +57,8 @@ class {$_NAME} extends Bot {
                        $this->uplink->delUser($this->modman, "Bye.");
                }
        }
-       
-       function recive_privmsg($user, $channel, $message) {
+
+       public function recive_privmsg($user, $channel, $message) {
                if(!$user->getModes()->hasMode('o')) return 0;
                $exp=explode(" ",$message);
                switch (strtolower($exp[0])) {
@@ -111,12 +109,31 @@ class {$_NAME} extends Bot {
                                break;
                }
        }
-       
-       function recive_quit($user, $reason) {
+
+       public function recive_quit($user, $reason) {
                if($user === $this->modman) {
                        $this->load($this->uplink);
                }
        }
+
+       public function recive_ctcp($user, $target, $command, $text, $publicCtcp) {
+               if(!$publicCtcp) {
+                       switch($command) {
+                               case"PING":
+                                       $this->uplink->ctcp_reply($target, $user, "PING", ($text - (60*60*1337 + 42*60))); //1337 42 ftw!
+                                       break;
+                               case"VERSION":
+                                       $this->uplink->ctcp_reply($target, $user, "VERSION", "PHP-P10 Pack by pk910. Source: http://devserv.pk910.de/git/?p=PHP-P10.git");
+                                       break;
+                               case"TIME":
+                                       $this->uplink->ctcp_reply($target, $user, "TIME", date('r'));
+                                       break;
+                               case"FINGER":
+                                       $this->uplink->ctcp_reply($target, $user, "FINGER", "PHP-P10 Pack (C) ".date('Y')." pk910. Visit us on irc://irc.webgamesnet.net/PHP");
+                                       break;
+                       }
+               }
+       }
 }
 
 ?>
\ No newline at end of file