added some more events
[PHP-P10.git] / BotLoader / BotLoader.class.php
index b5dc87b252cd482c934e5cf7581a0f91dc1d8e66..9fd0f70bf8599409d6b14142bc812c1e6a0d5cb8 100644 (file)
@@ -64,6 +64,7 @@ class BotLoader {
        }
        
        public function save() {
+               $this->saxdb->setSection("BotLoader", $this->botdb);
                $this->saxdb->writeDB("php_p10.db");
        }
        
@@ -94,6 +95,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 +113,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 +141,7 @@ class BotLoader {
                if(!$bot) return false;
                $bot->load($this->uplink, $data);
                $this->loadedBots[strtolower($name)] = $bot;
+               return true;
        }
        
        private function listLoadedBots() {