2 /********************************* PHP-P10 ******************************
3 * P10 uplink class by pk910 (c)2011 pk910 *
4 ************************************************************************
7 * PHP-P10 is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with PHP-P10; if not, write to the Free Software Foundation, *
19 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 ************************************************************************
23 * Bots/ModManager.class.php
25 * module manager bot...
29 class {$_NAME} extends Bot {
33 public function load($uplink, $old = false) {
34 $this->uplink = $uplink;
38 $host = "Services.WebGamesNet.net";
40 $realname = "Module Manager";
42 $this->modman = $this->uplink->addUser($nick,$ident,$host,$ip,$modes,$realname);
43 if(is_a($this->modman, "P10_User")) {
44 $this->uplink->join($this->modman, "#opers", (P10_Channel::USERPRIV_OPED | P10_Channel::USERPRIV_VOICE));
45 $this->uplink->join($this->modman, "#dev", P10_Channel::USERPRIV_VOICE);
51 ModCMD::bind($this, BIND_PRIVMSG, "recive_privmsg");
52 ModCMD::bind($this, BIND_QUIT, "recive_quit");
55 public function unload($rehash = false) {
59 $this->uplink->delUser($this->modman, "Bye.");
63 function recive_privmsg($user, $channel, $message) {
64 if(!$user->getModes()->hasMode('o')) return 0;
65 $exp=explode(" ",$message);
66 switch (strtolower($exp[0])) {
68 if(BotLoader::load($exp[1],$exp[2])) {
69 $this->uplink->privmsg($this->modman, $channel, "done.");
71 $this->uplink->privmsg($this->modman, $channel, "error.");
75 if(BotLoader::unload($exp[1])) {
76 $this->uplink->privmsg($this->modman, $channel, "done.");
78 $this->uplink->privmsg($this->modman, $channel, "error.");
82 if(BotLoader::rehash($exp[1])) {
83 $this->uplink->privmsg($this->modman, $channel, "done.");
85 $this->uplink->privmsg($this->modman, $channel, "error.");
89 $exp=explode(" ",$message,2);
92 $out = ob_get_contents();
94 $lines = explode("\n",$out);
95 for($i=0;$i<count($lines);$i++) {
97 $this->uplink->privmsg($this->modman, $channel, $lines[$i]);
100 $lines = explode("\n",$ret);
101 for($i=0;$i<count($lines);$i++) {
103 $this->uplink->privmsg($this->modman, $channel, $lines[$i]);
110 function recive_quit($user, $reason) {
111 if($user === $this->modman) {
112 $this->load($this->uplink);