2 /******************************* PHP-P10 v2 *****************************
3 * Copyright (C) 2011 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");
52 public function unload($rehash = false) {
56 $this->uplink->delUser($this->modman, "Bye.");
60 function recive_privmsg($user, $channel, $message) {
61 if(!$user->getModes()->hasMode('o')) return 0;
62 $exp=explode(" ",$message);
63 switch (strtolower($exp[0])) {
65 if(BotLoader::load($exp[1],$exp[2])) {
66 $this->uplink->privmsg($this->modman, $channel, "done.");
68 $this->uplink->privmsg($this->modman, $channel, "error.");
72 if(BotLoader::unload($exp[1])) {
73 $this->uplink->privmsg($this->modman, $channel, "done.");
75 $this->uplink->privmsg($this->modman, $channel, "error.");
79 if(BotLoader::rehash($exp[1])) {
80 $this->uplink->privmsg($this->modman, $channel, "done.");
82 $this->uplink->privmsg($this->modman, $channel, "error.");
86 foreach(BotLoader::listBots() as $name => $bot) {
87 $this->uplink->privmsg($this->modman, $channel, $name);
91 $exp=explode(" ",$message,2);
94 $out = ob_get_contents();
96 $lines = explode("\n",$out);
97 for($i=0;$i<count($lines);$i++) {
99 $this->uplink->privmsg($this->modman, $channel, $lines[$i]);
102 $lines = explode("\n",$ret);
103 for($i=0;$i<count($lines);$i++) {
105 $this->uplink->privmsg($this->modman, $channel, $lines[$i]);
112 function recive_quit($user, $reason) {
113 if($user === $this->modman) {
114 $this->load($this->uplink);