]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sethost.cpp
Broken code commented out by brain until we can fix it.
[user/henk/code/inspircd.git] / src / modules / m_sethost.cpp
index 774d5a00c8541e7572f30a23ccf628f7740f7f4d..f6a9bbf3f190340f87a87f62585b95024cfff021 100644 (file)
@@ -21,8 +21,19 @@ Server *Srv;
         
 void handle_sethost(char **parameters, int pcnt, userrec *user)
 {
-       strncpy(user->dhost,parameters[0],127);
-       Srv->SendOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+std::string(parameters[1]));
+       for (int x = 0; x < strlen(parameters[0]); x++)
+       {
+               if (((tolower(parameters[0][x]) < 'a') || (tolower(parameters[0][x]) > 'z')) && (parameters[0][x] != '.'))
+               {
+                       if (((parameters[0][x] < '0') || (parameters[0][x]> '9')) && (parameters[0][x] != '-'))
+                       {
+                               Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
+                               return;
+                       }
+               }
+       }
+       Srv->ChangeHost(user,parameters[0]);
+       Srv->SendOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+std::string(parameters[0]));
 }