X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_override.cpp;h=ce996d5b23b29bc5db1d954f01ed382d05b0c261;hb=1383dba43e463f292aea094d01f62f355946049d;hp=b43cc702c0e394099e8a0c8c417bcf4a8b6af831;hpb=1fa3b35712d2434a3acb033301e02d28ff0cca77;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index b43cc702c..ce996d5b2 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. * E-mail: * * @@ -14,15 +14,16 @@ * --------------------------------------------------- */ +using namespace std; + #include #include "users.h" #include "channels.h" #include "modules.h" +#include "helperfuncs.h" /* $ModDesc: Provides support for unreal-style oper-override */ -char dummyvalue[] = "on"; - class ModuleOverride : public Module { Server *Srv; @@ -31,20 +32,21 @@ class ModuleOverride : public Module public: - ModuleOverride() + ModuleOverride(Server* Me) + : Module::Module(Me) { // here we initialise our module. Use new to create new instances of the required // classes. - Srv = new Server; + Srv = Me; Conf = new ConfigReader; // read our config options (main config file) NoisyOverride = Conf->ReadFlag("override","noisy",0); } - virtual void OnRehash() + virtual void OnRehash(std::string parameter) { // on a rehash we delete our classes for good measure and create them again. delete Conf; @@ -53,6 +55,11 @@ class ModuleOverride : public Module NoisyOverride = Conf->ReadFlag("override","noisy",0); } + void Implements(char* List) + { + List[I_OnRehash] = List[I_OnAccessCheck] = List[I_On005Numeric] = List[I_OnUserPreJoin] = 1; + } + virtual void On005Numeric(std::string &output) { output = output + std::string(" OVERRIDE"); @@ -165,13 +172,14 @@ class ModuleOverride : public Module { if (chan) { - if ((chan->inviteonly) && (CanOverride(user,"INVITE"))) + if ((chan->binarymodes & CM_INVITEONLY) && (CanOverride(user,"INVITE"))) { if (NoisyOverride) { - if (!user->IsInvited(chan->name)) + irc::string x = chan->name; + if (!user->IsInvited(x)) { - WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,user,"NOTICE %s :%s invited himself into the channel",cname,user->nick); + WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,"NOTICE %s :%s invited himself into the channel",cname,user->nick); } } Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass +i on "+std::string(cname)); @@ -180,15 +188,15 @@ class ModuleOverride : public Module if ((chan->key[0]) && (CanOverride(user,"KEY"))) { if (NoisyOverride) - WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,user,"NOTICE %s :%s bypassed the channel key",cname,user->nick); + WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,"NOTICE %s :%s bypassed the channel key",cname,user->nick); Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass +k on "+std::string(cname)); return -1; } if ((chan->limit >= Srv->CountUsers(chan)) && (CanOverride(user,"LIMIT"))) { if (NoisyOverride) - WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,user,"NOTICE %s :%s passed through your channel limit",cname,user->nick); - Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass ++l on "+std::string(cname)); + WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,"NOTICE %s :%s passed through your channel limit",cname,user->nick); + Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass +l on "+std::string(cname)); return -1; } @@ -205,7 +213,6 @@ class ModuleOverride : public Module virtual ~ModuleOverride() { delete Conf; - delete Srv; } virtual Version GetVersion() @@ -226,9 +233,9 @@ class ModuleOverrideFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleOverride; + return new ModuleOverride(Me); } };