I made it so that the config uses 0 and 1 instead of off and on.
put in eoconst.hpp under "ACCOUNT_CHANGED = 6,":
ACCOUNT_DENY = 7,
put in account.cpp under "reply.SetID(PACKET_ACCOUNT, PACKET_REPLY);" in "PACKET_REQUEST" :
FOR REV <167
if (static_cast<std::string>(this->server->world->config["DisableRegistration"]) == "0")
{
reply.AddShort(ACCOUNT_DENY);
reply.AddString("NO");
}
FOR REV 168
if (!this->server->world->config["DisableRegistration"])
{
reply.AddShort(ACCOUNT_DENY);
reply.AddString("NO");
}
and replace "if (!Player::ValidName(username))" (under code you've pasted) with:
else if (!Player::ValidName(username))
and put under "CLIENT_SEND(reply);" :
FOR REV <167
if (static_cast<std::string>(this->server->world->config["DisableRegistration"]) == "0") this->Close();
FOR REV 168
if (!this->server->world->config["DisableRegistration"]) this->Close();
put in main.cpp under other eoserv_config_default:
eoserv_config_default(config, "DisableRegistration" , "1");
and somewhere in your config.ini:
##DisableRegistration
# Enables or disables registration
# Default : 1 (enable = 1 and disable = 0)
DisableRegistration= 1
And compile EOserv.
Now you can Disable registration setting "DisableRegistration" by changeing the config value to 0.