]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_override.cpp
Wahhhhhhhhhhhh bwahahaha. Mass commit to tidy up tons of messy include lists
[user/henk/code/inspircd.git] / src / modules / m_override.cpp
index c21b7f41329272511b3c38120794d097bf6f639e..b0143ea4522269714387f34ff6a5128f702f9e32 100644 (file)
 #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<std::string,std::string> override_t;
 
 class ModuleOverride : public Module
 {
-       Server *Srv;
+       
        override_t overrides;
        bool NoisyOverride;
  public:
  
        ModuleOverride(InspIRCd* Me)
                : Module::Module(Me)
-       {
-       
-               // here we initialise our module. Use new to create new instances of the required
-               // classes.
-               
-               
-               
+       {               
                // read our config options (main config file)
                OnRehash("");
        }
@@ -50,7 +41,7 @@ class ModuleOverride : public Module
        virtual void OnRehash(const std::string &parameter)
        {
                // 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);
@@ -108,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
@@ -213,7 +204,7 @@ class ModuleOverride : public Module
                                                if (!user->IsInvited(x))
                                                {
                                                        /* XXX - Ugly cast for a parameter that isn't used? :< - Om */
-                                                       chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "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));
@@ -223,7 +214,7 @@ class ModuleOverride : public Module
                                if ((chan->key[0]) && (CanOverride(user,"KEY")))
                                {
                                        if (NoisyOverride)
-                                               chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "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;
                                }
@@ -231,7 +222,7 @@ class ModuleOverride : public Module
                                if ((chan->limit > 0) && (chan->GetUserCounter() >=  chan->limit) && (CanOverride(user,"LIMIT")))
                                {
                                        if (NoisyOverride)
-                                               chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "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;
                                }
@@ -239,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;
                                }
                        }