From ee44af8d04f23b4a16c9b377764f930d69e575f7 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 27 Nov 2022 07:32:42 +0000 Subject: Refactor the internals of the oper system. - Allow overriding privileges from the blocks in the and blocks. - Separate oper types from oper accounts in the code. This enables moving some core stuff out of the config tag later. - Merge the config tags together to make a synthetic tag that can have getXXX called on it instead of using getConfig and then converting it. - Move the details of Have*Permission into the oper type class. - Improve oper events to allow modules to easily hook into the oper system. --- src/modules.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index a2fcb3059..575c54211 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -106,9 +106,6 @@ void Module::OnPreRehash(User*, const std::string&) { DetachEvent(I_OnPreRehash void Module::OnModuleRehash(User*, const std::string&) { DetachEvent(I_OnModuleRehash); } ModResult Module::OnUserPreJoin(LocalUser*, Channel*, const std::string&, std::string&, const std::string&, bool) { DetachEvent(I_OnUserPreJoin); return MOD_RES_PASSTHRU; } void Module::OnMode(User*, User*, Channel*, const Modes::ChangeList&, ModeParser::ModeProcessFlag) { DetachEvent(I_OnMode); } -void Module::OnOper(User*) { DetachEvent(I_OnOper); } -void Module::OnPostOper(User*) { DetachEvent(I_OnPostOper); } -void Module::OnPostDeoper(User*) { DetachEvent(I_OnPostDeoper); } ModResult Module::OnUserPreInvite(User*, User*, Channel*, time_t) { DetachEvent(I_OnUserPreInvite); return MOD_RES_PASSTHRU; } ModResult Module::OnUserPreMessage(User*, const MessageTarget&, MessageDetails&) { DetachEvent(I_OnUserPreMessage); return MOD_RES_PASSTHRU; } ModResult Module::OnUserPreNick(LocalUser*, const std::string&) { DetachEvent(I_OnUserPreNick); return MOD_RES_PASSTHRU; } @@ -165,6 +162,11 @@ void Module::OnServiceAdd(ServiceProvider&) { DetachEvent(I_OnServiceAdd); } void Module::OnServiceDel(ServiceProvider&) { DetachEvent(I_OnServiceDel); } ModResult Module::OnUserWrite(LocalUser*, ClientProtocol::Message&) { DetachEvent(I_OnUserWrite); return MOD_RES_PASSTHRU; } void Module::OnShutdown(const std::string& reason) { DetachEvent(I_OnShutdown); } +ModResult Module::OnPreOperLogin(LocalUser*, const std::shared_ptr&) { DetachEvent(I_OnPreOperLogin); return MOD_RES_PASSTHRU; } +void Module::OnOperLogin(User*, const std::shared_ptr&) { DetachEvent(I_OnOperLogin); } +void Module::OnPostOperLogin(User*) { DetachEvent(I_OnPostOperLogin); } +void Module::OnOperLogout(User*) { DetachEvent(I_OnOperLogout); } +void Module::OnPostOperLogout(User*, const std::shared_ptr&) { DetachEvent(I_OnPostOperLogout); } ServiceProvider::ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type) : creator(Creator), name(Name), service(Type) -- cgit v1.3.1-10-gc9f91