]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sethost.cpp
Add Module* creator to Command and ModeHandler
[user/henk/code/inspircd.git] / src / modules / m_sethost.cpp
index fbc71ff2f03027c61a9f6f7968477ee411b947c6..8442167cfb9c4ba6c785c56fca1d3f3f25a9a5ce 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -22,9 +22,8 @@ class CommandSethost : public Command
  private:
        char* hostmap;
  public:
-       CommandSethost (InspIRCd* Instance, char* hmap) : Command(Instance,"SETHOST","o",1), hostmap(hmap)
+       CommandSethost (InspIRCd* Instance, Module* Creator, char* hmap) : Command(Instance,Creator,"SETHOST","o",1), hostmap(hmap)
        {
-               this->source = "m_sethost.so";
                syntax = "<new-hostname>";
                TRANSLATE2(TR_TEXT, TR_END);
        }
@@ -53,7 +52,7 @@ class CommandSethost : public Command
 
                if (user->ChangeDisplayedHost(parameters[0].c_str()))
                {
-                       ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used SETHOST to change their displayed host to "+user->dhost);
+                       ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used SETHOST to change their displayed host to "+user->dhost);
                        return CMD_LOCALONLY;
                }
 
@@ -64,21 +63,20 @@ class CommandSethost : public Command
 
 class ModuleSetHost : public Module
 {
-       CommandSethost* mycommand;
+       CommandSethost cmd;
        char hostmap[256];
  public:
        ModuleSetHost(InspIRCd* Me)
-               : Module(Me)
+               : Module(Me), cmd(Me, this, hostmap)
        {
-               OnRehash(NULL,"");
-               mycommand = new CommandSethost(ServerInstance, hostmap);
-               ServerInstance->AddCommand(mycommand);
+               OnRehash(NULL);
+               ServerInstance->AddCommand(&cmd);
                Implementation eventlist[] = { I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
 
-       void OnRehash(User* user, const std::string &parameter)
+       void OnRehash(User* user)
        {
                ConfigReader Conf(ServerInstance);
                std::string hmap = Conf.ReadValue("hostname", "charmap", 0);
@@ -97,7 +95,7 @@ class ModuleSetHost : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_VENDOR, API_VERSION);
        }
 
 };