]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modmanager_static.cpp
m_spanningtree Remove unneeded #includes
[user/henk/code/inspircd.git] / src / modmanager_static.cpp
index 18a95f78f9ded633fcd5cb9e73d5bb89e890a169..23f30e1dffa46d795c6714b4fbbdd03dfe1225d5 100644 (file)
@@ -1,7 +1,27 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ *
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
 #define MODNAME cmd_all
 
 #include "inspircd.h"
 #include "exitcodes.h"
+#include <iostream>
 
 #ifdef PURE_STATIC
 
@@ -76,7 +96,7 @@ bool ModuleManager::Load(const std::string& name, bool defer)
                Modules[name] = mod;
                if (defer)
                {
-                       ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s", name.c_str());
+                       ServerInstance->Logs->Log("MODULE", LOG_DEFAULT,"New module introduced: %s", name.c_str());
                        return true;
                }
                else
@@ -88,7 +108,7 @@ bool ModuleManager::Load(const std::string& name, bool defer)
        {
                if (mod)
                        DoSafeUnload(mod);
-               ServerInstance->Logs->Log("MODULE", DEFAULT, "Unable to load " + name + ": " + modexcept.GetReason());
+               ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Unable to load " + name + ": " + modexcept.GetReason());
                return false;
        }
        FOREACH_MOD(I_OnLoadModule,OnLoadModule(mod));
@@ -105,10 +125,10 @@ bool ModuleManager::Load(const std::string& name, bool defer)
                if (prioritizationState == PRIO_STATE_LAST)
                        break;
                if (tries == 19)
-                       ServerInstance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected while loading " + name);
+                       ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected while loading " + name);
        }
 
-       ServerInstance->BuildISupport();
+       ServerInstance->ISupport.Build();
        return true;
 }
 
@@ -169,12 +189,12 @@ void ModuleManager::LoadAll()
        {
                ConfigTag* tag = i->second;
                std::string name = tag->getString("name");
-               printf_c("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",name.c_str());
+               std::cout << "[" << con_green << "*" << con_reset << "] Loading module:\t" << con_green << name << con_reset << std::endl;
 
                if (!this->Load(name, true))
                {
-                       ServerInstance->Logs->Log("MODULE", DEFAULT, this->LastError());
-                       printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str());
+                       ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError());
+                       std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl;
                        ServerInstance->Exit(EXIT_STATUS_MODULE);
                }
        }
@@ -182,15 +202,15 @@ void ModuleManager::LoadAll()
        for(std::map<std::string, Module*>::iterator i = Modules.begin(); i != Modules.end(); i++)
        {
                Module* mod = i->second;
-               try 
+               try
                {
                        mod->init();
                }
                catch (CoreException& modexcept)
                {
                        LastModuleError = "Unable to initialize " + mod->ModuleSourceFile + ": " + modexcept.GetReason();
-                       ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError);
-                       printf_c("\n[\033[1;31m*\033[0m] %s\n\n", LastModuleError.c_str());
+                       ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError);
+                       std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << LastModuleError << std::endl << std::endl;
                        ServerInstance->Exit(EXIT_STATUS_MODULE);
                }
        }
@@ -209,7 +229,7 @@ void ModuleManager::LoadAll()
                        break;
                if (tries == 19)
                {
-                       ServerInstance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected");
+                       ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected");
                        ServerInstance->Exit(EXIT_STATUS_MODULE);
                }
        }