2 /******************************* PHP-P10 v2 *****************************
3 * Copyright (C) 2011-2012 Philipp Kreil (pk910) *
5 * This program is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 ************************************************************************
20 * Bots/ModManager.class.php
22 * module manager bot...
26 class {$_NAME} extends Bot {
30 public function load($uplink, $old = false) {
31 $this->uplink = $uplink;
35 $host = "Services.WebGamesNet.net";
37 $realname = "Module Manager";
39 $this->modman = $this->uplink->addUser($nick,$ident,$host,$ip,$modes,$realname);
40 if(is_a($this->modman, "P10_User")) {
41 $this->uplink->join($this->modman, "#opers", (P10_Channel::USERPRIV_OPED | P10_Channel::USERPRIV_VOICE));
42 $this->uplink->join($this->modman, "#dev", P10_Channel::USERPRIV_VOICE);
48 ModCMD::bind($this, BIND_CHANMSG, "recive_privmsg");
49 ModCMD::bind($this, BIND_QUIT, "recive_quit");
50 ModCMD::bind($this, BIND_CTCP, "recive_ctcp");
53 public function unload($rehash = false) {
57 $this->uplink->delUser($this->modman, "Bye.");
61 public function recive_privmsg($user, $channel, $message) {
62 if(!$user->getModes()->hasMode('o')) return 0;
63 $exp=explode(" ",$message);
64 switch (strtolower($exp[0])) {
66 if(BotLoader::load($exp[1],$exp[2])) {
67 $this->uplink->privmsg($this->modman, $channel, "done.");
69 $this->uplink->privmsg($this->modman, $channel, "error.");
73 if(BotLoader::unload($exp[1])) {
74 $this->uplink->privmsg($this->modman, $channel, "done.");
76 $this->uplink->privmsg($this->modman, $channel, "error.");
80 if(BotLoader::rehash($exp[1])) {
81 $this->uplink->privmsg($this->modman, $channel, "done.");
83 $this->uplink->privmsg($this->modman, $channel, "error.");
87 foreach(BotLoader::listBots() as $name => $bot) {
88 $this->uplink->privmsg($this->modman, $channel, $name);
92 $exp=explode(" ",$message,2);
95 $out = ob_get_contents();
97 $lines = explode("\n",$out);
98 for($i=0;$i<count($lines);$i++) {
100 $this->uplink->privmsg($this->modman, $channel, $lines[$i]);
103 $lines = explode("\n",$ret);
104 for($i=0;$i<count($lines);$i++) {
106 $this->uplink->privmsg($this->modman, $channel, $lines[$i]);
113 public function recive_quit($user, $reason) {
114 if($user === $this->modman) {
115 $this->load($this->uplink);
119 public function recive_ctcp($user, $target, $command, $text, $publicCtcp) {
123 $this->uplink->ctcp_reply($target, $user, "PING", ($text - (60*60*1337 + 42*60))); //1337 42 ftw!
126 $this->uplink->ctcp_reply($target, $user, "VERSION", "PHP-P10 Pack by pk910. Source: http://devserv.pk910.de/git/?p=PHP-P10.git");
129 $this->uplink->ctcp_reply($target, $user, "TIME", date('r'));
132 $this->uplink->ctcp_reply($target, $user, "FINGER", "PHP-P10 Pack (C) ".date('Y')." pk910. Visit us on irc://irc.webgamesnet.net/PHP");