]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cloaking.cpp
OOPS! We try again, since I'm smoking craq. LF is 0x0a NOT CR.
[user/henk/code/inspircd.git] / src / modules / m_cloaking.cpp
index 3506c8bee3bf334c1f2304639ef6a8b46f84a6f3..dfa5ee4e8b45603afa3041111ec178cf9ab17832 100644 (file)
  * ---------------------------------------------------
  */
 
-#include "inspircd_config.h"
-#include "configreader.h"
 #include "inspircd.h"
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
-
 #include "m_hash.h"
 
 /* $ModDesc: Provides masking of user hostnames */
@@ -77,8 +74,7 @@ class CloakUser : public ModeHandler
 
        ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
        {
-               /* Only opers can change other users modes */
-               if ((source != dest) && (!*source->oper))
+               if (source != dest)
                        return MODEACTION_DENY;
 
                /* For remote clients, we dont take any action, we just allow it.
@@ -214,7 +210,7 @@ class CloakUser : public ModeHandler
                /* If we get here, yes it really is an ipv6 ip */
                unsigned int iv[] = { key1, key2, key3, key4 };
                std::vector<std::string> hashies;
-               std::string item = "";
+               std::string item;
                int rounds = 0;
 
                /* Reset the Hash module and send it our IV */
@@ -229,7 +225,7 @@ class CloakUser : public ModeHandler
                                /* Send the Hash module a different hex table for each octet group's Hash sum */
                                HashHexRequest(Sender, HashProvider, xtab[(key1+rounds) % 4]).Send();
                                hashies.push_back(std::string(HashSumRequest(Sender, HashProvider, item).Send()).substr(0,8));
-                               item = "";
+                               item.clear();
                        }
                        rounds++;
                }
@@ -238,7 +234,7 @@ class CloakUser : public ModeHandler
                        /* Send the Hash module a different hex table for each octet group's Hash sum */
                        HashHexRequest(Sender, HashProvider, xtab[(key1+rounds) % 4]).Send();
                        hashies.push_back(std::string(HashSumRequest(Sender, HashProvider, item).Send()).substr(0,8));
-                       item = "";
+                       item.clear();
                }
                /* Stick them all together */
                return irc::stringjoiner(":", hashies, 0, hashies.size() - 1).GetJoined();
@@ -272,7 +268,7 @@ class ModuleCloaking : public Module
 
  public:
        ModuleCloaking(InspIRCd* Me)
-               : Module::Module(Me)
+               : Module(Me)
        {
                ServerInstance->UseInterface("HashRequest");
 
@@ -316,28 +312,4 @@ class ModuleCloaking : public Module
        }
 };
 
-// stuff down here is the module-factory stuff. For basic modules you can ignore this.
-
-class ModuleCloakingFactory : public ModuleFactory
-{
- public:
-       ModuleCloakingFactory()
-       {
-       }
-       
-       ~ModuleCloakingFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleCloaking(Me);
-       }
-       
-};
-
-
-extern "C" void * init_module( void )
-{
-       return new ModuleCloakingFactory;
-}
+MODULE_INIT(ModuleCloaking)