+ const char* x = parameters[1].c_str();
+
+ if (parameters[1].length() > 63)
+ {
+ user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick.c_str());
+ return CMD_FAILURE;
+ }
+
+ for (; *x; x++)
+ {
+ if (!hostmap[(unsigned char)*x])
+ {
+ user->WriteServ("NOTICE "+user->nick+" :*** CHGHOST: Invalid characters in hostname");
+ return CMD_FAILURE;
+ }
+ }
+
+ User* dest = ServerInstance->FindNick(parameters[0]);
+
+ // Allow services to change the host of unregistered users
+ if ((!dest) || ((dest->registered != REG_ALL) && (!ServerInstance->ULine(user->server))))
+ {
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str());
+ return CMD_FAILURE;
+ }
+
+ if (IS_LOCAL(dest))