From cc720a6f138b95580a689e4e30502f0cdb96f638 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Sun, 4 Aug 2013 08:01:07 -0500 Subject: [PATCH] Put FSDATA version code in llversioninfo.cpp with the other version code. --- indra/newview/fsdata.cpp | 6 ++---- indra/newview/fsversionvalues.h.in | 5 +++++ indra/newview/llversioninfo.cpp | 25 +++++++++++++++++++++++++ indra/newview/llversioninfo.h | 5 +++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/indra/newview/fsdata.cpp b/indra/newview/fsdata.cpp index 7e1277aa67..3c4249f8fb 100644 --- a/indra/newview/fsdata.cpp +++ b/indra/newview/fsdata.cpp @@ -32,7 +32,6 @@ #include "fsdata.h" #include "fscommon.h" -#include "fsversionvalues.h" #include "fswsassetblacklist.h" /* boost: will not compile unless equivalent is undef'd, beware. */ @@ -54,7 +53,6 @@ #include "llviewernetwork.h" #include "llxorcipher.h" -const std::string VERSION_ID = llformat("%s %d.%d.%d (%d)", LL_VIEWER_CHANNEL, LL_VIEWER_VERSION_MAJOR, LL_VIEWER_VERSION_MINOR, LL_VIEWER_VERSION_PATCH, LL_VIEWER_VERSION_BUILD); const std::string FSDATA_URL = "http://phoenixviewer.com/app/fsdatatest/data.xml"; const std::string AGENTS_URL = "http://phoenixviewer.com/app/fsdatatest/agents.xml"; const std::string LEGACY_CLIENT_LIST_URL = "http://phoenixviewer.com/app/client_tags/client_list_v2.xml"; @@ -110,7 +108,7 @@ FSData::FSData() : mAgentsDone(false) { mHeaders.insert("User-Agent", LLViewerMedia::getCurrentUserAgent()); - mHeaders.insert("viewer-version", VERSION_ID); + mHeaders.insert("viewer-version", LLVersionInfo::getChannelAndVersionFS()); } void FSData::processResponder(const LLSD& content, const std::string& url, bool save_to_file, const LLDate& last_modified) @@ -679,7 +677,7 @@ bool FSData::isDeveloper(LLUUID avatar_id) LLSD FSData::allowedLogin() { - std::map::iterator iter = mBlockedVersions.find(VERSION_ID); + std::map::iterator iter = mBlockedVersions.find(LLVersionInfo::getChannelAndVersionFS()); if (iter == mBlockedVersions.end()) { return LLSD(); diff --git a/indra/newview/fsversionvalues.h.in b/indra/newview/fsversionvalues.h.in index d4576b0788..f695c24361 100755 --- a/indra/newview/fsversionvalues.h.in +++ b/indra/newview/fsversionvalues.h.in @@ -32,6 +32,11 @@ // Define the version and channel substitution macros here instead // of via cmake compile-time defines in order to not force a rebuild // of the entire newview directory with every Mercurial pull +// NOTE: This file should not be included anywhere in the main viewer code +// but llversioninfo.cpp. If you need the current viewer version in +// a different format than is already provided there, then add a +// function to that file and reference it, rather than building your +// own function elsewhere. #define LL_VIEWER_CHANNEL "@VIEWER_CHANNEL@" #define LL_VIEWER_VERSION_MAJOR @VIEWER_VERSION_MAJOR@ #define LL_VIEWER_VERSION_MINOR @VIEWER_VERSION_MINOR@ diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp index 68467d829c..d1c56ee84b 100755 --- a/indra/newview/llversioninfo.cpp +++ b/indra/newview/llversioninfo.cpp @@ -112,6 +112,11 @@ namespace // Storage for the "version and channel" string. // This will get reset too. std::string sVersionChannel(""); + + // Same as above, with version number in Firestorm FSDATA + // format. Unlike the above, the channel name will always be the + // hardcoded version. + std::string sVersionChannelFS(""); } //static @@ -126,6 +131,26 @@ const std::string &LLVersionInfo::getChannelAndVersion() return sVersionChannel; } +// Get version and channel in the format needed for FSDATA. +//static +const std::string &LLVersionInfo::getChannelAndVersionFS() +{ + if (sVersionChannelFS.empty()) + { + // cache the version string + std::ostringstream stream; + stream << LL_VIEWER_CHANNEL << " " + << LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH << " (" + << LL_VIEWER_VERSION_BUILD << ")"; + sVersionChannelFS = stream.str(); + } + + return sVersionChannelFS; +} +// + //static const std::string &LLVersionInfo::getChannel() { diff --git a/indra/newview/llversioninfo.h b/indra/newview/llversioninfo.h index 536f95a228..771844bd95 100755 --- a/indra/newview/llversioninfo.h +++ b/indra/newview/llversioninfo.h @@ -63,6 +63,11 @@ public: /// like "Second Life Release 2.0.0.200030" static const std::string &getChannelAndVersion(); + // Needed for fsdata version checking + /// return the viewer version and hardcoded channel as a string + /// like "Firestorm-Release 2.0.0 (200030)" + static const std::string &getChannelAndVersionFS(); + /// return the channel name, e.g. "Second Life" static const std::string &getChannel();