]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/server.cpp
Tidy up keywords on module methods.
[user/henk/code/inspircd.git] / src / server.cpp
index d4797dce692bfb73101fa0345b1bc7afc62ddba1..c2068d75bb169e4e084f30734c5848137afba6e7 100644 (file)
@@ -66,17 +66,11 @@ 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[] =
@@ -106,35 +100,30 @@ void UIDGenerator::IncrementUID(unsigned int pos)
         * A again, in an iterative fashion.. so..
         * AAA9 -> AABA, and so on. -- w00t
         */
-       if ((pos == 3) && (current_uid[3] == '9'))
+
+       // If we hit Z, wrap around to 0.
+       if (current_uid[pos] == 'Z')
        {
-               // At pos 3, if we hit '9', we've run out of available UIDs, and need to reset to AAA..AAA.
-               for (int i = 3; i < UUID_LENGTH-1; i++)
+               current_uid[pos] = '0';
+       }
+       else if (current_uid[pos] == '9')
+       {
+               /*
+                * Or, if we hit 9, wrap around to pos = 'A' and (pos - 1)++,
+                * e.g. A9 -> BA -> BB ..
+                */
+               current_uid[pos] = 'A';
+               if (pos == 3)
                {
-                       current_uid[i] = 'A';
+                       // At pos 3, if we hit '9', we've run out of available UIDs, and reset to AAA..AAA.
+                       return;
                }
+               this->IncrementUID(pos - 1);
        }
        else
        {
-               // If we hit Z, wrap around to 0.
-               if (current_uid[pos] == 'Z')
-               {
-                       current_uid[pos] = '0';
-               }
-               else if (current_uid[pos] == '9')
-               {
-                       /*
-                        * Or, if we hit 9, wrap around to pos = 'A' and (pos - 1)++,
-                        * e.g. A9 -> BA -> BB ..
-                        */
-                       current_uid[pos] = 'A';
-                       this->IncrementUID(pos - 1);
-               }
-               else
-               {
-                       // Anything else, nobody gives a shit. Just increment.
-                       current_uid[pos]++;
-               }
+               // Anything else, nobody gives a shit. Just increment.
+               current_uid[pos]++;
        }
 }
 
@@ -148,15 +137,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';
 }
 
 /*
@@ -167,7 +151,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;