X-Git-Url: http://git.pk910.de/?p=PHP-P10.git;a=blobdiff_plain;f=BotLoader%2FBotLoader.class.php;h=b13be3657aa2f1676c67283700524d8771edc3d1;hp=b5dc87b252cd482c934e5cf7581a0f91dc1d8e66;hb=0f30e96ae37491aee19e72b89cc54a6798d1f254;hpb=74fcc85514c9bd0a4a8dfbd909d9555a9f1ee5b8 diff --git a/BotLoader/BotLoader.class.php b/BotLoader/BotLoader.class.php index b5dc87b..b13be36 100644 --- a/BotLoader/BotLoader.class.php +++ b/BotLoader/BotLoader.class.php @@ -1,22 +1,19 @@ . * * * ************************************************************************ * @@ -64,6 +61,7 @@ class BotLoader { } public function save() { + $this->saxdb->setSection("BotLoader", $this->botdb); $this->saxdb->writeDB("php_p10.db"); } @@ -94,6 +92,7 @@ class BotLoader { if(!array_key_exists($name, $this->botdb["bots"])) { $this->botdb["bots"][$name] = $botfile; } + return true; } private function unloadBot($name, $delete = true) { @@ -111,10 +110,19 @@ class BotLoader { if(array_key_exists($name, $this->botdb["bots"]) && $delete) { unset($this->botdb["bots"][$name]); } + return true; } private function rehashBot($name) { if(!(array_key_exists(strtolower($name), $this->loadedBots))) return false; + $botfile = null; + foreach($this->botdb["bots"] as $botname => $file) { + if(strtolower($botname) == strtolower($name)) { + $botfile = $file; + break; + } + } + if(!$botfile) break; //rehash bot $bot = $this->loadedBots[strtolower($name)]; if(array_key_exists(strtolower($name), $this->botDatabases)) { @@ -130,6 +138,7 @@ class BotLoader { if(!$bot) return false; $bot->load($this->uplink, $data); $this->loadedBots[strtolower($name)] = $bot; + return true; } private function listLoadedBots() {