]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_hostchange.cpp
To be more specific, specify rpath() macro here
[user/henk/code/inspircd.git] / src / modules / m_hostchange.cpp
index d4da6d1ff27b8ce9934888e09c22da9b321f16e7..473a35d124e9e8a4a5347267d5bd56b241c6595f 100644 (file)
@@ -2,20 +2,15 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *               <Craig@chatspike.net>
- *     
- * Written by Craig Edwards, Craig McLure, and others.
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
  *
  * ---------------------------------------------------
  */
 
-using namespace std;
-
 #include <stdio.h>
 #include "users.h"
 #include "channels.h"
@@ -24,8 +19,8 @@ using namespace std;
 
 /* $ModDesc: Provides masking of user hostnames in a different way to m_cloaking */
 
-extern InspIRCd* ServerInstance;
-
+/** Holds information on a host set by m_hostchange
+ */
 class Host : public classbase
 {
  public:
@@ -39,18 +34,17 @@ class ModuleHostChange : public Module
 {
  private:
 
-       Server *Srv;
+       
        ConfigReader *Conf;
        hostchanges_t hostchanges;
        std::string MySuffix;
         
  public:
-       ModuleHostChange(Server* Me)
+       ModuleHostChange(InspIRCd* Me)
                : Module::Module(Me)
        {
-               Srv = Me;
-               Conf = new ConfigReader;
-               OnRehash("");
+               Conf = new ConfigReader(ServerInstance);
+               OnRehash(NULL,"");
        }
        
        virtual ~ModuleHostChange()
@@ -68,10 +62,10 @@ class ModuleHostChange : public Module
                List[I_OnRehash] = List[I_OnUserConnect] = 1;
        }
 
-       virtual void OnRehash(const std::string &parameter)
+       virtual void OnRehash(userrec* user, const std::string &parameter)
        {
                DELETE(Conf);
-               Conf = new ConfigReader;
+               Conf = new ConfigReader(ServerInstance);
                MySuffix = Conf->ReadValue("host","suffix",0);
                for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++)
                {
@@ -94,14 +88,14 @@ class ModuleHostChange : public Module
        {
                // returns the version number of the module to be
                // listed in /MODULES
-               return Version(1,0,0,1,VF_VENDOR);
+               return Version(1,1,0,1,VF_VENDOR,API_VERSION);
        }
        
        virtual void OnUserConnect(userrec* user)
        {
                for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++)
                {
-                       if (Srv->MatchText(std::string(user->ident)+"@"+std::string(user->host),i->first))
+                       if (ServerInstance->MatchText(std::string(user->ident)+"@"+std::string(user->host),i->first))
                        {
                                Host* h = (Host*)i->second;
                                // host of new user matches a hostchange tag's mask
@@ -158,7 +152,7 @@ class ModuleHostChangeFactory : public ModuleFactory
        {
        }
        
-       virtual Module * CreateModule(Server* Me)
+       virtual Module * CreateModule(InspIRCd* Me)
        {
                return new ModuleHostChange(Me);
        }