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; }
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;
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:
this->Modes->Process(parameters, user);
}
+
+void InspIRCd::SendGlobalMode(const std::vector<std::string>& parameters, User *user)
+{
+ Modes->Process(parameters, user);
+ if (!Modes->GetLastParse().empty())
+ this->PI->SendMode(parameters[0], Modes->GetLastParseParams(), Modes->GetLastParseTranslate());
+}
+
bool InspIRCd::AddResolver(Resolver* r, bool cached)
{
if (!cached)
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");
}