]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/server.cpp
Clean up the FileReader class and all of the modules that use it.
[user/henk/code/inspircd.git] / src / server.cpp
index c49e17b565a8549f0cb3b093138b4c511b483b21..66b175a1ad5d9785aed9cab63d78b75f5aeb3a4f 100644 (file)
@@ -66,24 +66,13 @@ void RehashHandler::Call(const std::string &reason)
        }
 }
 
-std::string InspIRCd::GetVersionString(bool operstring)
+std::string InspIRCd::GetVersionString(bool getFullVersion)
 {
-       char versiondata[MAXBUF];
-       if (operstring)
-       {
-               std::string sename = SE->GetName();
-               snprintf(versiondata,MAXBUF,"%s %s :%s [%s,%s,%s]",VERSION, Config->ServerName.c_str(), SYSTEM,REVISION, sename.c_str(), Config->sid.c_str());
-       }
-       else
-               snprintf(versiondata,MAXBUF,"%s %s :%s",BRANCH,Config->ServerName.c_str(),Config->CustomVersion.c_str());
-       return versiondata;
+       if (getFullVersion)
+               return VERSION " " + Config->ServerName + " :" SYSTEM " [" REVISION "," + SE->GetName() + "," + Config->sid + "]";
+       return BRANCH " " + Config->ServerName + " :" + Config->CustomVersion;
 }
 
-const char InspIRCd::LogHeader[] =
-       "Log started for " VERSION " (" REVISION ", " MODULE_INIT_STR ")"
-       " - compiled on " SYSTEM;
-
-
 std::string UIDGenerator::GenerateSID(const std::string& servername, const std::string& serverdesc)
 {
        unsigned int sid = 0;
@@ -94,6 +83,7 @@ std::string UIDGenerator::GenerateSID(const std::string& servername, const std::
                sid = 5 * sid + *i;
 
        std::string sidstr = ConvToStr(sid % 1000);
+       sidstr.insert(0, 3 - sidstr.length(), '0');
        return sidstr;
 }
 
@@ -143,15 +133,10 @@ void UIDGenerator::init(const std::string& sid)
         *              -- w
         */
 
+       current_uid.resize(UUID_LENGTH, '9');
        current_uid[0] = sid[0];
        current_uid[1] = sid[1];
        current_uid[2] = sid[2];
-
-       for (int i = 3; i < (UUID_LENGTH - 1); i++)
-               current_uid[i] = '9';
-
-       // Null terminator. Important.
-       current_uid[UUID_LENGTH - 1] = '\0';
 }
 
 /*
@@ -162,7 +147,7 @@ std::string UIDGenerator::GetUID()
        while (1)
        {
                // Add one to the last UID
-               this->IncrementUID(UUID_LENGTH - 2);
+               this->IncrementUID(UUID_LENGTH - 1);
 
                if (!ServerInstance->FindUUID(current_uid))
                        break;