summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp197
1 files changed, 132 insertions, 65 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 2a355474b1..8e959993fe 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -153,7 +153,7 @@
#include "llworld.h"
#include "llhudeffecttrail.h"
#include "llvectorperfoptions.h"
-#include "llslurl.h"
+#include "llurlsimstring.h"
#include "llwatchdog.h"
// Included so that constants/settings might be initialized
@@ -193,9 +193,6 @@
#include "llparcel.h"
#include "llavatariconctrl.h"
-// Include for security api initialization
-#include "llsecapi.h"
-
// *FIX: These extern globals should be cleaned up.
// The globals either represent state/config/resource-storage of either
// this app, or another 'component' of the viewer. App globals should be
@@ -510,6 +507,35 @@ public:
}
};
+void LLAppViewer::initGridChoice()
+{
+ // Load up the initial grid choice from:
+ // - hard coded defaults...
+ // - command line settings...
+ // - if dev build, persisted settings...
+
+ // Set the "grid choice", this is specified by command line.
+ std::string grid_choice = gSavedSettings.getString("CmdLineGridChoice");
+ LLViewerLogin::getInstance()->setGridChoice(grid_choice);
+
+ // Load last server choice by default
+ // ignored if the command line grid choice has been set
+ if(grid_choice.empty())
+ {
+ S32 server = gSavedSettings.getS32("ServerChoice");
+ server = llclamp(server, 0, (S32)GRID_INFO_COUNT - 1);
+ if(server == GRID_INFO_OTHER)
+ {
+ std::string custom_server = gSavedSettings.getString("CustomServer");
+ LLViewerLogin::getInstance()->setGridChoice(custom_server);
+ }
+ else if(server != (S32)GRID_INFO_NONE)
+ {
+ LLViewerLogin::getInstance()->setGridChoice((EGridInfo)server);
+ }
+ }
+}
+
//virtual
bool LLAppViewer::initSLURLHandler()
{
@@ -621,6 +647,7 @@ bool LLAppViewer::init()
LLCurl::initClass();
initThreads();
+
writeSystemInfo();
// Build a string representing the current version number.
@@ -750,6 +777,10 @@ bool LLAppViewer::init()
return false;
}
+ // Always fetch the Ethernet MAC address, needed both for login
+ // and password load.
+ LLUUID::getNodeID(gMACAddress);
+
// Prepare for out-of-memory situations, during which we will crash on
// purpose and save a dump.
#if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP
@@ -861,7 +892,6 @@ bool LLAppViewer::init()
}
}
-
// save the graphics card
gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString();
@@ -872,17 +902,6 @@ bool LLAppViewer::init()
gSimFrames = (F32)gFrameCount;
LLViewerJoystick::getInstance()->init(false);
-
- try {
- initializeSecHandler();
- }
- catch (LLProtectedDataException ex)
- {
- LLNotificationsUtil::add("CorruptedProtectedDataStore");
- }
- LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback);
-
-
gGLActive = FALSE;
if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
{
@@ -917,11 +936,13 @@ bool LLAppViewer::mainLoop()
gServicePump = new LLPumpIO(gAPRPoolp);
LLHTTPClient::setPump(*gServicePump);
LLCurl::setCAFile(gDirUtilp->getCAFile());
-
+ LLCurl::setSSLVerify(! gSavedSettings.getBOOL("NoVerifySSLCert"));
+
// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
LLVoiceChannel::initClass();
- LLVoiceClient::getInstance()->init(gServicePump);
+ LLVoiceClient::init(gServicePump);
+
LLTimer frameTimer,idleTimer;
LLTimer debugTime;
LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
@@ -1252,7 +1273,7 @@ bool LLAppViewer::cleanup()
// to ensure shutdown order
LLMortician::setZealous(TRUE);
- LLVoiceClient::getInstance()->terminate();
+ LLVoiceClient::terminate();
disconnectViewer();
@@ -1451,6 +1472,13 @@ bool LLAppViewer::cleanup()
llinfos << "Saving Data" << llendflush;
+ // Quitting with "Remember Password" turned off should always stomp your
+ // saved password, whether or not you successfully logged in. JC
+ if (!gSavedSettings.getBOOL("RememberPassword"))
+ {
+ LLStartUp::deletePasswordFromDisk();
+ }
+
// Store the time of our current logoff
gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
@@ -2019,6 +2047,7 @@ bool LLAppViewer::initConfiguration()
}
}
+ initGridChoice();
// If we have specified crash on startup, set the global so we'll trigger the crash at the right time
if(clp.hasOption("crashonstartup"))
@@ -2112,17 +2141,30 @@ bool LLAppViewer::initConfiguration()
// injection and steal passwords. Phoenix. SL-55321
if(clp.hasOption("url"))
{
- LLStartUp::setStartSLURL(LLSLURL(clp.getOption("url")[0]));
- if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION)
- {
- LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid());
-
- }
+ std::string slurl = clp.getOption("url")[0];
+ if (LLSLURL::isSLURLCommand(slurl))
+ {
+ LLStartUp::sSLURLCommand = slurl;
+ }
+ else
+ {
+ LLURLSimString::setString(slurl);
+ }
}
else if(clp.hasOption("slurl"))
{
- LLSLURL start_slurl(clp.getOption("slurl")[0]);
- LLStartUp::setStartSLURL(start_slurl);
+ std::string slurl = clp.getOption("slurl")[0];
+ if(LLSLURL::isSLURL(slurl))
+ {
+ if (LLSLURL::isSLURLCommand(slurl))
+ {
+ LLStartUp::sSLURLCommand = slurl;
+ }
+ else
+ {
+ LLURLSimString::setString(slurl);
+ }
+ }
}
const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
@@ -2203,10 +2245,18 @@ bool LLAppViewer::initConfiguration()
// don't call anotherInstanceRunning() when doing URL handoff, as
// it relies on checking a marker file which will not work when running
// out of different directories
-
- if (LLStartUp::getStartSLURL().isValid())
+ std::string slurl;
+ if (!LLStartUp::sSLURLCommand.empty())
+ {
+ slurl = LLStartUp::sSLURLCommand;
+ }
+ else if (LLURLSimString::parse())
{
- if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString()))
+ slurl = LLURLSimString::getURL();
+ }
+ if (!slurl.empty())
+ {
+ if (sendURLToOtherInstance(slurl))
{
// successfully handed off URL to existing instance, exit
return false;
@@ -2262,9 +2312,9 @@ bool LLAppViewer::initConfiguration()
// need to do this here - need to have initialized global settings first
std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
- if ( !nextLoginLocation.empty() )
+ if ( nextLoginLocation.length() )
{
- LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
+ LLURLSimString::setString( nextLoginLocation );
};
gLastRunVersion = gSavedSettings.getString("LastRunVersion");
@@ -2485,7 +2535,7 @@ void LLAppViewer::writeSystemInfo()
// The user is not logged on yet, but record the current grid choice login url
// which may have been the intended grid. This can b
- gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
+ gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
// *FIX:Mani - move this ddown in llappviewerwin32
#ifdef LL_WINDOWS
@@ -2966,41 +3016,59 @@ void LLAppViewer::migrateCacheDirectory()
#endif // LL_WINDOWS || LL_DARWIN
}
+//static
+S32 LLAppViewer::getCacheVersion()
+{
+ static const S32 cache_version = 7;
+
+ return cache_version ;
+}
+
bool LLAppViewer::initCache()
{
mPurgeCache = false;
- // Purge cache if user requested it
- if (gSavedSettings.getBOOL("PurgeCacheOnStartup") ||
- gSavedSettings.getBOOL("PurgeCacheOnNextStartup"))
+ BOOL disable_texture_cache = FALSE ;
+ BOOL read_only = mSecondInstance ? TRUE : FALSE;
+ LLAppViewer::getTextureCache()->setReadOnly(read_only) ;
+
+ if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getCacheVersion())
{
- gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
- mPurgeCache = true;
+ if(read_only)
+ {
+ disable_texture_cache = TRUE ; //if the cache version of this viewer is different from the running one, this viewer can not use the texture cache.
+ }
+ else
+ {
+ mPurgeCache = true; // Purge cache if the version number is different.
+ gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getCacheVersion());
+ }
}
- // Purge cache if it belongs to an old version
- else
+
+ if(!read_only)
{
- static const S32 cache_version = 6;
- if (gSavedSettings.getS32("LocalCacheVersion") != cache_version)
+ // Purge cache if user requested it
+ if (gSavedSettings.getBOOL("PurgeCacheOnStartup") ||
+ gSavedSettings.getBOOL("PurgeCacheOnNextStartup"))
{
+ gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
mPurgeCache = true;
- gSavedSettings.setS32("LocalCacheVersion", cache_version);
}
- }
- // We have moved the location of the cache directory over time.
- migrateCacheDirectory();
-
- // Setup and verify the cache location
- std::string cache_location = gSavedSettings.getString("CacheLocation");
- std::string new_cache_location = gSavedSettings.getString("NewCacheLocation");
- if (new_cache_location != cache_location)
- {
- gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"));
- purgeCache(); // purge old cache
- gSavedSettings.setString("CacheLocation", new_cache_location);
- gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location));
- }
+ // We have moved the location of the cache directory over time.
+ migrateCacheDirectory();
+ // Setup and verify the cache location
+ std::string cache_location = gSavedSettings.getString("CacheLocation");
+ std::string new_cache_location = gSavedSettings.getString("NewCacheLocation");
+ if (new_cache_location != cache_location)
+ {
+ gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"));
+ purgeCache(); // purge old cache
+ gSavedSettings.setString("CacheLocation", new_cache_location);
+ gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location));
+ }
+ }
+
if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")))
{
LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL;
@@ -3008,7 +3076,7 @@ bool LLAppViewer::initCache()
gSavedSettings.setString("CacheLocationTopFolder", "");
}
- if (mPurgeCache)
+ if (mPurgeCache && !read_only)
{
LLSplashScreen::update(LLTrans::getString("StartupClearingCache"));
purgeCache();
@@ -3017,14 +3085,13 @@ bool LLAppViewer::initCache()
LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache"));
// Init the texture cache
- // Allocate 80% of the cache size for textures
- BOOL read_only = mSecondInstance ? TRUE : FALSE;
+ // Allocate 80% of the cache size for textures
const S32 MB = 1024*1024;
S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB;
const S64 MAX_CACHE_SIZE = 1024*MB;
cache_size = llmin(cache_size, MAX_CACHE_SIZE);
S64 texture_cache_size = ((cache_size * 8)/10);
- S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, read_only);
+ S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, disable_texture_cache);
texture_cache_size -= extra;
LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS"));
@@ -3836,7 +3903,7 @@ void LLAppViewer::sendLogoutRequest()
gLogoutMaxTime = LOGOUT_REQUEST_TIME;
mLogoutRequestSent = TRUE;
- LLVoiceClient::getInstance()->leaveChannel();
+ gVoiceClient->leaveChannel();
//Set internal status variables and marker files
gLogoutInProgress = TRUE;
@@ -4256,7 +4323,7 @@ void LLAppViewer::launchUpdater()
#endif
// *TODO change userserver to be grid on both viewer and sim, since
// userserver no longer exists.
- query_map["userserver"] = LLGridManager::getInstance()->getGridLabel();
+ query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel();
query_map["channel"] = gSavedSettings.getString("VersionChannelName");
// *TODO constantize this guy
// *NOTE: This URL is also used in win_setup/lldownloader.cpp
@@ -4269,10 +4336,10 @@ void LLAppViewer::launchUpdater()
LLAppViewer::sUpdaterInfo = new LLAppViewer::LLUpdaterInfo() ;
// if a sim name was passed in via command line parameter (typically through a SLURL)
- if ( LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION )
+ if ( LLURLSimString::sInstance.mSimString.length() )
{
// record the location to start at next time
- gSavedSettings.setString( "NextLoginLocation", LLStartUp::getStartSLURL().getSLURLString());
+ gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString );
};
#if LL_WINDOWS