git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11850
e03df62e-2008-0410-955e-
edbf42e46eb7
{
ServerInstance->Logs->Log("CONFIG",DEFAULT,"Validating server id");
{
ServerInstance->Logs->Log("CONFIG",DEFAULT,"Validating server id");
- const char *sid = data.GetString();
+ const std::string& sid = data.GetValue();
- if (*sid && !ServerInstance->IsSID(sid))
+ if (!ServerInstance->IsSID(sid))
- throw CoreException(std::string(sid) + " is not a valid server ID. A server ID must be 3 characters long, with the first character a digit and the next two characters a digit or letter.");
+ throw CoreException(sid + " is not a valid server ID. A server ID must be 3 characters long, with the first character a digit and the next two characters a digit or letter.");
if (Config->sid.empty())
{
// Generate one
if (Config->sid.empty())
{
// Generate one
+ int sid = 0;
+ char sidstr[4];
for (const char* x = Config->ServerName.c_str(); *x; ++x)
sid = 5 * sid + *x;
for (const char* y = Config->ServerDesc.c_str(); *y; ++y)
sid = 5 * sid + *y;
for (const char* x = Config->ServerName.c_str(); *x; ++x)
sid = 5 * sid + *x;
for (const char* y = Config->ServerDesc.c_str(); *y; ++y)
sid = 5 * sid + *y;
+ sprintf(sidstr, "%03d", sid % 1000);
- Config->sid = ConvToStr(sid);
}
/* set up fake client again this time with the correct uid */
}
/* set up fake client again this time with the correct uid */