]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
If SVSNICK is sent to force a change to a UID-lookalike, just change nick to UID...
[user/henk/code/inspircd.git] / src / modules.cpp
index b25469c30b17405a2a162cd9eab48d1f1bbc788b..529e88b07220e6aceb9e05573b9a3a904396a19a 100644 (file)
@@ -99,8 +99,8 @@ ModResult     Module::OnKill(User*, User*, const std::string&) { return MOD_RES_PASS
 void           Module::OnLoadModule(Module*) { }
 void           Module::OnUnloadModule(Module*) { }
 void           Module::OnBackgroundTimer(time_t) { }
-ModResult      Module::OnPreCommand(std::string&, std::vector<std::string>&, User *, bool, const std::string&) { return MOD_RES_PASSTHRU; }
-void           Module::OnPostCommand(const std::string&, const std::vector<std::string>&, User *, CmdResult, const std::string&) { }
+ModResult      Module::OnPreCommand(std::string&, std::vector<std::string>&, LocalUser*, bool, const std::string&) { return MOD_RES_PASSTHRU; }
+void           Module::OnPostCommand(const std::string&, const std::vector<std::string>&, LocalUser*, CmdResult, const std::string&) { }
 ModResult      Module::OnCheckReady(LocalUser*) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnUserRegister(LocalUser*) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnUserPreKick(User*, Membership*, const std::string&) { return MOD_RES_PASSTHRU; }
@@ -174,6 +174,9 @@ ModuleManager::~ModuleManager()
 
 bool ModuleManager::Attach(Implementation i, Module* mod)
 {
+       if (Modules.find(mod->ModuleSourceFile) == Modules.end())
+               ServerInstance->Logs->Log("MODULE", DEFAULT, "Module is attaching to hook %d in constructor; this does not handle exceptions correctly!", i);
+
        if (std::find(EventHandlers[i].begin(), EventHandlers[i].end(), mod) != EventHandlers[i].end())
                return false;
 
@@ -417,16 +420,12 @@ bool InspIRCd::IsValidModuleCommand(const std::string &commandname, int pcnt, Us
        return this->Parser->IsValidCommand(commandname, pcnt, user);
 }
 
-void InspIRCd::AddCommand(Command *f)
-{
-       if (!this->Parser->AddCommand(f))
-       {
-               throw ModuleException("Command "+std::string(f->name)+" already exists.");
-       }
-}
-
 void ModuleManager::AddService(ServiceProvider& item)
 {
+       Module* owner = item.creator;
+       if (Modules.find(owner->ModuleSourceFile) == Modules.end())
+               ServerInstance->Logs->Log("MODULE", DEFAULT, "Module is registering item %s in constructor; this does not handle exceptions correctly!", item.name.c_str());
+
        switch (item.service)
        {
                case SERVICE_COMMAND:
@@ -559,6 +558,8 @@ const std::vector<std::string> ModuleManager::GetAllModuleNames(int filter)
 ConfigReader::ConfigReader()
 {
        this->error = 0;
+       ServerInstance->Logs->Log("MODULE", DEBUG, "ConfigReader is deprecated in 2.0; "
+               "use ServerInstance->Config->ConfValue(\"key\") or ->ConfTags(\"key\") instead");
 }