]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_override.cpp
Updated copyrights in headers etc using perl inplace edit
[user/henk/code/inspircd.git] / src / modules / m_override.cpp
index 80066bb0f2c5f9cf244202b2a867e906b08dbe33..ce996d5b23b29bc5db1d954f01ed382d05b0c261 100644 (file)
@@ -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:
  *                <brain@chatspike.net>
  *               <Craig@chatspike.net>
@@ -14,6 +14,8 @@
  * ---------------------------------------------------
  */
 
+using namespace std;
+
 #include <stdio.h>
 #include "users.h"
 #include "channels.h"
@@ -22,8 +24,6 @@
 
 /* $ModDesc: Provides support for unreal-style oper-override */
 
-char dummyvalue[] = "on";
-
 class ModuleOverride : public Module
 {
        Server *Srv;
@@ -32,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;
@@ -54,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");
@@ -170,7 +176,8 @@ class ModuleOverride : public Module
                                {
                                        if (NoisyOverride)
                                        {
-                                               if (!user->IsInvited(chan->name))
+                                               irc::string x = chan->name;
+                                               if (!user->IsInvited(x))
                                                {
                                                        WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,"NOTICE %s :%s invited himself into the channel",cname,user->nick);
                                                }
@@ -206,7 +213,6 @@ class ModuleOverride : public Module
        virtual ~ModuleOverride()
        {
                delete Conf;
-               delete Srv;
        }
        
        virtual Version GetVersion()
@@ -227,9 +233,9 @@ class ModuleOverrideFactory : public ModuleFactory
        {
        }
        
-       virtual Module * CreateModule()
+       virtual Module * CreateModule(Server* Me)
        {
-               return new ModuleOverride;
+               return new ModuleOverride(Me);
        }
        
 };