]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sethost.cpp
Fix these to use new hook system (u_listmode wasnt fixed yet)
[user/henk/code/inspircd.git] / src / modules / m_sethost.cpp
index 59b48fbc1c1ae4980eb2c92245f229e6fe9a9e05..7f0b3e1aadc9344146971db983b77fa0197e23d3 100644 (file)
 
 /** Handle /SETHOST
  */
-class cmd_sethost : public Command
+class CommandSethost : public Command
 {
  private:
        char* hostmap;
  public:
-       cmd_sethost (InspIRCd* Instance, char* hmap) : Command(Instance,"SETHOST",'o',1), hostmap(hmap)
+       CommandSethost (InspIRCd* Instance, char* hmap) : Command(Instance,"SETHOST",'o',1), hostmap(hmap)
        {
                this->source = "m_sethost.so";
                syntax = "<new-hostname>";
                TRANSLATE2(TR_TEXT, TR_END);
        }
 
-       CmdResult Handle (const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle (const char** parameters, int pcnt, User *user)
        {
                size_t len = 0;
                for (const char* x = parameters[0]; *x; x++, len++)
@@ -63,15 +63,17 @@ class cmd_sethost : public Command
 
 class ModuleSetHost : public Module
 {
-       cmd_sethost* mycommand;
+       CommandSethost* mycommand;
        char hostmap[256];
  public:
        ModuleSetHost(InspIRCd* Me)
                : Module(Me)
        {       
                OnRehash(NULL,"");
-               mycommand = new cmd_sethost(ServerInstance, hostmap);
+               mycommand = new CommandSethost(ServerInstance, hostmap);
                ServerInstance->AddCommand(mycommand);
+               Implementation eventlist[] = { I_OnRehash };
+               ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
        void Implements(char* List)
@@ -79,7 +81,7 @@ class ModuleSetHost : public Module
                List[I_OnRehash] = 1;
        }
 
-       void OnRehash(userrec* user, const std::string &parameter)
+       void OnRehash(User* user, const std::string &parameter)
        {
                ConfigReader Conf(ServerInstance);
                std::string hmap = Conf.ReadValue("hostname", "charmap", 0);