summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp13
-rw-r--r--src/inspircd.cpp19
-rw-r--r--src/server.cpp4
3 files changed, 28 insertions, 8 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index ec15db3a1..c5f37a1e4 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -367,6 +367,18 @@ bool ValidateInvite(ServerConfig* conf, const char* tag, const char* value, Valu
return true;
}
+bool ValidateSID(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
+{
+ int sid = data.GetInteger();
+ if ((sid > 999) || (sid < 0))
+ {
+ sid = sid % 1000;
+ data.Set(sid);
+ conf->GetInstance()->Log(DEFAULT,"WARNING: Server ID is less than 0 or greater than 999. Set to %d", sid);
+ }
+ return true;
+}
+
bool ValidateWhoWas(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
{
conf->WhoWasMaxKeep = conf->GetInstance()->Duration(data.GetString());
@@ -634,6 +646,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{"server", "name", "", new ValueContainerChar (this->ServerName), DT_CHARPTR, ValidateServerName},
{"server", "description", "Configure Me", new ValueContainerChar (this->ServerDesc), DT_CHARPTR, NoValidation},
{"server", "network", "Network", new ValueContainerChar (this->Network), DT_CHARPTR, NoValidation},
+ {"server", "id", "0", new ValueContainerInt (&this->sid), DT_INTEGER, ValidateSID},
{"admin", "name", "", new ValueContainerChar (this->AdminName), DT_CHARPTR, NoValidation},
{"admin", "email", "Mis@configu.red", new ValueContainerChar (this->AdminEmail), DT_CHARPTR, NoValidation},
{"admin", "nick", "Misconfigured", new ValueContainerChar (this->AdminNick), DT_CHARPTR, NoValidation},
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 9543ef856..1618266c0 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -544,11 +544,20 @@ InspIRCd::InspIRCd(int argc, char** argv)
/* Generate SID */
size_t sid = 0;
- for (const char* x = Config->ServerName; *x; ++x)
- sid = 5 * sid + *x;
- for (const char* y = Config->ServerDesc; *y; ++y)
- sid = 5 * sid + *y;
- sid = sid % 999;
+ if (Config->sid)
+ {
+ sid = Config->sid;
+ }
+ else
+ {
+ for (const char* x = Config->ServerName; *x; ++x)
+ sid = 5 * sid + *x;
+ for (const char* y = Config->ServerDesc; *y; ++y)
+ sid = 5 * sid + *y;
+ sid = sid % 999;
+
+ Config->sid = sid;
+ }
current_uid[0] = sid / 100 + 48;
current_uid[1] = ((sid / 10) % 10) + 48;
current_uid[2] = sid % 10 + 48;
diff --git a/src/server.cpp b/src/server.cpp
index 041b9f5dd..ea2ec4928 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -69,15 +69,13 @@ void InspIRCd::RehashServer()
std::string InspIRCd::GetVersionString()
{
char versiondata[MAXBUF];
- char dnsengine[] = "singlethread-object";
-
if (*Config->CustomVersion)
{
snprintf(versiondata,MAXBUF,"%s %s :%s",VERSION,Config->ServerName,Config->CustomVersion);
}
else
{
- snprintf(versiondata,MAXBUF,"%s %s :%s [FLAGS=%s,%s,%s]",VERSION,Config->ServerName,SYSTEM,REVISION,SE->GetName().c_str(),dnsengine);
+ snprintf(versiondata,MAXBUF,"%s %s :%s [FLAGS=%s,%s,%d]",VERSION,Config->ServerName,SYSTEM,REVISION,SE->GetName().c_str(),Config->sid);
}
return versiondata;
}