]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chghost.cpp
Broken code commented out by brain until we can fix it.
[user/henk/code/inspircd.git] / src / modules / m_chghost.cpp
index 885bee679544c9c23fd8c1f916d953bbe9f377de..c70c56967d37013b4c0b876c86b368516e3f888b 100644 (file)
@@ -20,10 +20,20 @@ Server *Srv;
         
 void handle_chghost(char **parameters, int pcnt, userrec *user)
 {
-       userrec* dest = Srv->FindNick(std::string(parameters[0]));
+       for (int x = 0; x < strlen(parameters[1]); x++)
+       {
+               if (((tolower(parameters[1][x]) < 'a') || (tolower(parameters[1][x]) > 'z')) && (parameters[1][x] != '.'))
+               {
+                       if (((parameters[1][x] < '0') || (parameters[1][x]> '9')) && (parameters[1][x] != '-'))
+                       {
+                               Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
+                               return;
+                       }
+               }
+       }       userrec* dest = Srv->FindNick(std::string(parameters[0]));
        if (dest)
        {
-               strncpy(dest->dhost,parameters[1],127);
+               Srv->ChangeHost(dest,parameters[1]);
                Srv->SendOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+std::string(dest->nick)+" become "+std::string(parameters[1]));
        }
 }