]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Don't hard code the branch version.
authorPeter Powell <petpow@saberuk.com>
Wed, 11 Jul 2012 19:38:17 +0000 (20:38 +0100)
committerattilamolnar <attilamolnar@hush.com>
Thu, 26 Jul 2012 22:14:43 +0000 (00:14 +0200)
configure
src/server.cpp
src/users.cpp
win/configure.cpp

index 5a54b286be341fcb9ef9525a2f00bb51ae0076cd..6021a805d6b77922a1b68a306152b1a824dce4a4 100755 (executable)
--- a/configure
+++ b/configure
@@ -848,6 +848,11 @@ sub writefiles {
        chomp(my $incos = `uname -n -s -r`);
        chomp(my $version = `sh src/version.sh`);
        chomp(my $revision2 = getrevision());
+       my $branch = "InspIRCd-0.0";
+       if ($version =~ /^(InspIRCd-[0-9]+\.[0-9]+)\.[0-9]+/)
+       {
+               $branch = $1;
+       }
        if ($writeheader == 1)
        {
                print "Writing \e[1;32minspircd_config.h\e[0m\n";
@@ -933,6 +938,7 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
 
                open(FILEHANDLE, ">include/inspircd_version.h.tmp");
                print FILEHANDLE <<EOF;
+#define BRANCH "$branch"
 #define VERSION "$version"
 #define REVISION "$revision2"
 #define SYSTEM "$incos"
index 4bd81a6d1ba970bd09b3f4b24d5fd64bc6d64998..b7e58c56be00155db48b22d8ea62c7c097dd5138 100644 (file)
@@ -72,7 +72,7 @@ std::string InspIRCd::GetVersionString(bool operstring)
        if (operstring)
                snprintf(versiondata,MAXBUF,"%s %s :%s [%s,%s,%s]",VERSION,Config->ServerName.c_str(),SYSTEM,REVISION,SE->GetName().c_str(),Config->sid.c_str());
        else
-               snprintf(versiondata,MAXBUF,"InspIRCd-2.0 %s :%s",Config->ServerName.c_str(),Config->CustomVersion.c_str());
+               snprintf(versiondata,MAXBUF,"%s %s :%s",BRANCH,Config->ServerName.c_str(),Config->CustomVersion.c_str());
        return versiondata;
 }
 
index 9c3d645f72c0a64b2ea6491269fedc18a32724db..459b9e3cefe8b64518998f439317c00ba52d931e 100644 (file)
@@ -772,9 +772,9 @@ void LocalUser::FullConnect()
 
        this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",ServerInstance->Config->Network.c_str());
        this->WriteNumeric(RPL_WELCOME, "%s :Welcome to the %s IRC Network %s!%s@%s",this->nick.c_str(), ServerInstance->Config->Network.c_str(), this->nick.c_str(), this->ident.c_str(), this->host.c_str());
-       this->WriteNumeric(RPL_YOURHOSTIS, "%s :Your host is %s, running version InspIRCd-2.0",this->nick.c_str(),ServerInstance->Config->ServerName.c_str());
+       this->WriteNumeric(RPL_YOURHOSTIS, "%s :Your host is %s, running version %s",this->nick.c_str(),ServerInstance->Config->ServerName.c_str(),BRANCH);
        this->WriteNumeric(RPL_SERVERCREATED, "%s :This server was created %s %s", this->nick.c_str(), __TIME__, __DATE__);
-       this->WriteNumeric(RPL_SERVERVERSION, "%s %s InspIRCd-2.0 %s %s %s", this->nick.c_str(), ServerInstance->Config->ServerName.c_str(), ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str());
+       this->WriteNumeric(RPL_SERVERVERSION, "%s %s %s %s %s %s", this->nick.c_str(), ServerInstance->Config->ServerName.c_str(), BRANCH, ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str());
 
        ServerInstance->Config->Send005(this);
        this->WriteNumeric(RPL_YOURUUID, "%s %s :your unique ID", this->nick.c_str(), this->uuid.c_str());
index ee03b3659e95a5f158217eedcef56a1d7d5085b0..768b68cc5de72841e7d05bc268ee9ab051c0eefc 100644 (file)
@@ -275,7 +275,11 @@ void Run()
                fclose(fI);
        }
        else
-               strcpy(version, "InspIRCD-Unknown");
+               strcpy(version, "InspIRCd-0.0.0");
+       
+       string branch(version);
+       branch.erase(branch.find_last_of('.'));
+       
 #ifdef WIN64
        printf_c("Your operating system is: \033[1;32mwindows_x64 \033[0m\n");
 #else
@@ -351,6 +355,7 @@ void Run()
        sc(TGREEN); printf(" done\n"); sc(TNORMAL);
        printf("Writing inspircd_version.h...");
        f = fopen("inspircd_version.h", "w");
+       fprintf(f, "#define BRANCH \"%s\"\n", branch.c_str());
        fprintf(f, "#define VERSION \"%s\"\n", version);
        fprintf(f, "#define REVISION \"%s\"\n", revision.c_str());
        fprintf(f, "#define SYSTEM \"%s\"\n", machine_text);