X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_override.cpp;h=b0143ea4522269714387f34ff6a5128f702f9e32;hb=d54fd9b1e6b31f69332a9241b5f17330c0ad61e0;hp=a3bb407edfdc4d99031ee673d936461627ade75d;hpb=dafc021be4f3ad34ca37953de6a0109a161dd165;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index a3bb407ed..b0143ea45 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -17,31 +17,23 @@ #include "users.h" #include "channels.h" #include "modules.h" -#include "helperfuncs.h" +#include "configreader.h" #include "inspircd.h" /* $ModDesc: Provides support for unreal-style oper-override */ -extern InspIRCd* ServerInstance; - typedef std::map override_t; class ModuleOverride : public Module { - Server *Srv; + override_t overrides; bool NoisyOverride; public: - ModuleOverride(Server* Me) + ModuleOverride(InspIRCd* Me) : Module::Module(Me) - { - - // here we initialise our module. Use new to create new instances of the required - // classes. - - Srv = Me; - + { // read our config options (main config file) OnRehash(""); } @@ -49,7 +41,7 @@ class ModuleOverride : public Module virtual void OnRehash(const std::string ¶meter) { // on a rehash we delete our classes for good measure and create them again. - ConfigReader* Conf = new ConfigReader; + ConfigReader* Conf = new ConfigReader(ServerInstance); // re-read our config options on a rehash NoisyOverride = Conf->ReadFlag("override","noisy",0); @@ -107,7 +99,7 @@ class ModuleOverride : public Module { if (*source->oper) { - if ((Srv) && (source) && (channel)) + if (source && channel) { // Fix by brain - allow the change if they arent on channel - rely on boolean short-circuit // to not check the other items in the statement if they arent on the channel @@ -212,7 +204,7 @@ class ModuleOverride : public Module if (!user->IsInvited(x)) { /* XXX - Ugly cast for a parameter that isn't used? :< - Om */ - chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s invited himself into the channel", cname, user->nick); + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass invite-only", cname, user->nick); } } ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +i on "+std::string(cname)); @@ -222,7 +214,7 @@ class ModuleOverride : public Module if ((chan->key[0]) && (CanOverride(user,"KEY"))) { if (NoisyOverride) - chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s bypassed the channel key", cname, user->nick); + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass the channel key", cname, user->nick); ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +k on "+std::string(cname)); return -1; } @@ -230,7 +222,7 @@ class ModuleOverride : public Module if ((chan->limit > 0) && (chan->GetUserCounter() >= chan->limit) && (CanOverride(user,"LIMIT"))) { if (NoisyOverride) - chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s passed through your channel limit", cname, user->nick); + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass the channel limit", cname, user->nick); ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +l on "+std::string(cname)); return -1; } @@ -238,6 +230,8 @@ class ModuleOverride : public Module if (CanOverride(user,"BANWALK")) { // other join + if (NoisyOverride) + chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass channel bans", cname, user->nick); return -1; } } @@ -267,7 +261,7 @@ class ModuleOverrideFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleOverride(Me); }