X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules.cpp;h=ca312c4a5ec44d4500f23268f1c1fedeaf74d100;hb=b954283ccc4253a6881513bbe7f743c39886d3b7;hp=7f3695adeddb3f4e425a6cf6f01fa114c5db2c80;hpb=98f3924960d849691abc81e0928dc43ad9233b01;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules.cpp b/src/modules.cpp index 7f3695ade..ca312c4a5 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -87,7 +87,7 @@ void Module::OnPreRehash(User*, const std::string&) { } void Module::OnModuleRehash(User*, const std::string&) { } void Module::OnRehash(User*) { } ModResult Module::OnUserPreJoin(LocalUser*, Channel*, const std::string&, std::string&, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnMode(User*, void*, int, const std::vector&, const std::vector&) { } +void Module::OnMode(User*, User*, Channel*, const std::vector&, const std::vector&) { } void Module::OnOper(User*, const std::string&) { } void Module::OnPostOper(User*, const std::string&, const std::string &) { } void Module::OnInfo(User*) { } @@ -125,7 +125,6 @@ ModResult Module::OnPassCompare(Extensible* ex, const std::string &password, con void Module::OnGlobalOper(User*) { } void Module::OnPostConnect(User*) { } void Module::OnUserMessage(User*, void*, int, const std::string&, char, const CUList&, MessageType) { } -void Module::OnRemoteKill(User*, User*, const std::string&, const std::string&) { } void Module::OnUserInvite(User*, User*, Channel*, time_t) { } void Module::OnPostTopicChange(User*, Channel*, const std::string&) { } void Module::OnGetServerDescription(const std::string&, std::string&) { } @@ -416,11 +415,14 @@ void ModuleManager::AddService(ServiceProvider& item) throw ModuleException("Command "+std::string(item.name)+" already exists."); return; case SERVICE_MODE: - if (!ServerInstance->Modes->AddMode(static_cast(&item))) + { + ModeHandler* mh = static_cast(&item); + if (!ServerInstance->Modes->AddMode(mh)) throw ModuleException("Mode "+std::string(item.name)+" already exists."); - DataProviders.insert(std::make_pair("mode/" + item.name, &item)); + DataProviders.insert(std::make_pair((mh->GetModeType() == MODETYPE_CHANNEL ? "mode/" : "umode/") + item.name, &item)); dynamic_reference_base::reset_all(); return; + } case SERVICE_METADATA: if (!ServerInstance->Extensions.Register(static_cast(&item))) throw ModuleException("Extension " + std::string(item.name) + " already exists."); @@ -428,8 +430,8 @@ void ModuleManager::AddService(ServiceProvider& item) case SERVICE_DATA: case SERVICE_IOHOOK: { - if (item.name.substr(0, 5) == "mode/") - throw ModuleException("The \"mode/\" service name prefix is reserved."); + if ((item.name.substr(0, 5) == "mode/") || (item.name.substr(0, 6) == "umode/")) + throw ModuleException("The \"mode/\" and the \"umode\" service name prefixes are reserved."); DataProviders.insert(std::make_pair(item.name, &item)); std::string::size_type slash = item.name.find('/'); @@ -534,13 +536,6 @@ void dynamic_reference_base::resolve() value = NULL; } -void InspIRCd::SendGlobalMode(const std::vector& parameters, User *user) -{ - Modes->Process(parameters, user); - if (!Modes->GetLastParse().empty()) - this->PI->SendMode(parameters[0], Modes->GetLastParseParams(), Modes->GetLastParseTranslate()); -} - Module* ModuleManager::Find(const std::string &name) { std::map::iterator modfind = Modules.find(name);