]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_oper_hash.cpp
This one too, grr
[user/henk/code/inspircd.git] / src / modules / m_oper_hash.cpp
index 80869898cc0445fcc60efeb905ae90ab025c95aa..fd7e683dec3079c9a22bdc2dad5dd1888853be2d 100644 (file)
 /* $ModDesc: Allows for hashed oper passwords */
 /* $ModDep: m_hash.h */
 
-#include "inspircd_config.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "inspircd.h"
-
 #include "m_hash.h"
 
 typedef std::map<irc::string, Module*> hashymodules;
 
 /* Handle /MKPASSWD
  */
-class cmd_mkpasswd : public command_t
+class CommandMkpasswd : public Command
 {
        Module* Sender;
        hashymodules &hashers;
        std::deque<std::string> &names;
  public:
-       cmd_mkpasswd (InspIRCd* Instance, Module* S, hashymodules &h, std::deque<std::string> &n)
-               : command_t(Instance,"MKPASSWD", 'o', 2), Sender(S), hashers(h), names(n)
+       CommandMkpasswd (InspIRCd* Instance, Module* S, hashymodules &h, std::deque<std::string> &n)
+               : Command(Instance,"MKPASSWD", 'o', 2), Sender(S), hashers(h), names(n)
        {
                this->source = "m_oper_hash.so";
                syntax = "<hashtype> <any-text>";
        }
 
-       void MakeHash(userrec* user, const char* algo, const char* stuff)
+       void MakeHash(User* user, const char* algo, const char* stuff)
        {
                /* Lets see if they gave us an algorithm which has been implemented */
                hashymodules::iterator x = hashers.find(algo);
@@ -57,10 +52,10 @@ class cmd_mkpasswd : public command_t
                }
        }
 
-       CmdResult Handle (const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle (const char** parameters, int pcnt, User *user)
        {
                MakeHash(user, parameters[0], parameters[1]);
-               /* NOTE: Don't propogate this across the network!
+               /* NOTE: Don't propagate this across the network!
                 * We dont want plaintext passes going all over the place...
                 * To make sure it goes nowhere, return CMD_FAILURE!
                 */
@@ -71,7 +66,7 @@ class cmd_mkpasswd : public command_t
 class ModuleOperHash : public Module
 {
        
-       cmd_mkpasswd* mycommand;
+       CommandMkpasswd* mycommand;
        ConfigReader* Conf;
        hashymodules hashers; /* List of modules which implement HashRequest */
        std::deque<std::string> names; /* Module names which implement HashRequest */
@@ -86,10 +81,10 @@ class ModuleOperHash : public Module
                Conf = NULL;
                OnRehash(NULL,"");
 
-               ServerInstance->UseInterface("HashRequest");
+               ServerInstance->Modules->UseInterface("HashRequest");
 
                /* Find all modules which implement the interface 'HashRequest' */
-               modulelist* ml = ServerInstance->FindInterface("HashRequest");
+               modulelist* ml = ServerInstance->Modules->FindInterface("HashRequest");
 
                /* Did we find any modules? */
                if (ml)
@@ -111,13 +106,13 @@ class ModuleOperHash : public Module
                        throw ModuleException("I can't find any modules loaded which implement the HashRequest interface! You probably forgot to load a hashing module such as m_md5.so or m_sha256.so.");
                }
 
-               mycommand = new cmd_mkpasswd(ServerInstance, this, hashers, names);
+               mycommand = new CommandMkpasswd(ServerInstance, this, hashers, names);
                ServerInstance->AddCommand(mycommand);
        }
        
        virtual ~ModuleOperHash()
        {
-               ServerInstance->DoneWithInterface("HashRequest");
+               ServerInstance->Modules->DoneWithInterface("HashRequest");
        }
 
        void Implements(char* List)
@@ -125,7 +120,7 @@ class ModuleOperHash : public Module
                List[I_OnRehash] = List[I_OnOperCompare] = 1;
        }
 
-       virtual void OnRehash(userrec* user, const std::string &parameter)
+       virtual void OnRehash(User* user, const std::string &parameter)
        {
                /* Re-read configuration file */
                if (Conf)
@@ -162,27 +157,4 @@ class ModuleOperHash : public Module
        }
 };
 
-
-class ModuleOperHashFactory : public ModuleFactory
-{
- public:
-       ModuleOperHashFactory()
-       {
-       }
-       
-       ~ModuleOperHashFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleOperHash(Me);
-       }
-       
-};
-
-
-extern "C" DllExport void * init_module( void )
-{
-       return new ModuleOperHashFactory;
-}
+MODULE_INIT(ModuleOperHash)