]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sethost.cpp
Attach to events and register services in init()
[user/henk/code/inspircd.git] / src / modules / m_sethost.cpp
index 8bab2c3b4e98f6631928fbfeb3bc1634acf1e960..e4662791dc18a3febb4d7b0ccfb3911a5e21607b 100644 (file)
@@ -43,7 +43,7 @@ class CommandSethost : public Command
                {
                        if (!hostmap[(const unsigned char)*x])
                        {
-                               user->WriteServ("NOTICE "+std::string(user->nick)+" :*** SETHOST: Invalid characters in hostname");
+                               user->WriteServ("NOTICE "+user->nick+" :*** SETHOST: Invalid characters in hostname");
                                return CMD_FAILURE;
                        }
                }
@@ -60,7 +60,7 @@ class CommandSethost : public Command
 
                if (user->ChangeDisplayedHost(parameters[0].c_str()))
                {
-                       ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used SETHOST to change their displayed host to "+user->dhost);
+                       ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SETHOST to change their displayed host to "+user->dhost);
                        return CMD_SUCCESS;
                }
 
@@ -76,6 +76,10 @@ class ModuleSetHost : public Module
  public:
        ModuleSetHost()
                : cmd(this, hostmap)
+       {
+       }
+
+       void init()
        {
                OnRehash(NULL);
                ServerInstance->AddCommand(&cmd);
@@ -83,14 +87,9 @@ class ModuleSetHost : public Module
                ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
-
        void OnRehash(User* user)
        {
-               ConfigReader Conf;
-               std::string hmap = Conf.ReadValue("hostname", "charmap", 0);
-
-               if (hmap.empty())
-                       hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789";
+               std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789");
 
                memset(hostmap, 0, sizeof(hostmap));
                for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)