diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanellogin.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llurldispatcher.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewernetwork.cpp | 88 | ||||
-rw-r--r-- | indra/newview/llviewernetwork.h | 18 | ||||
-rw-r--r-- | indra/newview/tests/llviewernetwork_test.cpp | 26 |
5 files changed, 80 insertions, 58 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 0009f7203a..c8dae024cf 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1164,7 +1164,8 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe) void LLPanelLogin::updateLoginPanelLinks() { - LLSD grid_data = LLGridManager::getInstance()->getGridInfo(); + LLSD grid_data; + LLGridManager::getInstance()->getGridInfo(grid_data); bool system_grid = grid_data.has(GRID_IS_SYSTEM_GRID_VALUE); // need to call through sInstance, as it's called from onSelectServer, which diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index 9efa6c4108..cbaa7248a2 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -215,7 +215,8 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& LLSD args; args["SLURL"] = slurl.getLocationString(); args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel(); - LLSD grid_info = LLGridManager::getInstance()->getGridInfo(slurl.getGrid()); + LLSD grid_info; + LLGridManager::getInstance()->getGridInfo(slurl.getGrid(), grid_info); if(grid_info.has(GRID_LABEL_VALUE)) { diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index 619deaf50b..a81bb2e6f2 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -296,7 +296,6 @@ void LLGridManager::initialize(const std::string& grid_file) // any grid list entries with. LLSD grid = LLSD::emptyMap(); - bool grid_dirty = false; if(mGridList.has(mGrid)) { grid = mGridList[mGrid]; @@ -304,52 +303,53 @@ void LLGridManager::initialize(const std::string& grid_file) else { grid[GRID_VALUE] = mGrid; - grid_dirty = true; + // add the grid with the additional values, or update the + // existing grid if it exists with the given values + addGrid(grid); + } + + LL_DEBUGS("GridManager") << "Selected grid is " << mGrid << LL_ENDL; + setGridChoice(mGrid); + if(mGridList[mGrid][GRID_LOGIN_URI_VALUE].isArray()) + { + llinfos << "is array" << llendl; } +} + +LLGridManager::~LLGridManager() +{ + saveFavorites(); +} + +void LLGridManager::getGridInfo(const std::string &grid, LLSD& grid_info) +{ + + grid_info = mGridList[grid]; + + // override any grid data with the command line info. LLSD cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI"); if (cmd_line_login_uri.isString()) - { - grid_dirty = true; - grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray(); - grid[GRID_LOGIN_URI_VALUE].append(cmd_line_login_uri); + { + grid_info[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray(); + grid_info[GRID_LOGIN_URI_VALUE].append(cmd_line_login_uri); } // override the helper uri if it was passed in std::string cmd_line_helper_uri = gSavedSettings.getString("CmdLineHelperURI"); if(!cmd_line_helper_uri.empty()) { - grid[GRID_HELPER_URI_VALUE] = cmd_line_helper_uri; - grid_dirty = true; + grid_info[GRID_HELPER_URI_VALUE] = cmd_line_helper_uri; } // override the login page if it was passed in std::string cmd_line_login_page = gSavedSettings.getString("LoginPage"); if(!cmd_line_login_page.empty()) { - grid[GRID_LOGIN_PAGE_VALUE] = cmd_line_login_page; - grid_dirty = true; - } - - - if(grid_dirty) - { - // add the grid with the additional values, or update the - // existing grid if it exists with the given values - addGrid(grid); - } - LL_DEBUGS("GridManager") << "Selected grid is " << mGrid << LL_ENDL; - setGridChoice(mGrid); - if(mGridList[mGrid][GRID_LOGIN_URI_VALUE].isArray()) - { - llinfos << "is array" << llendl; - } + grid_info[GRID_LOGIN_PAGE_VALUE] = cmd_line_login_page; + } } -LLGridManager::~LLGridManager() -{ - saveFavorites(); -} // // LLGridManager::addGrid - add a grid to the grid list, populating the needed values @@ -523,6 +523,12 @@ std::string LLGridManager::getGridByLabel( const std::string &grid_label, bool c void LLGridManager::getLoginURIs(std::vector<std::string>& uris) { uris.clear(); + LLSD cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI"); + if (cmd_line_login_uri.isString()) + { + uris.push_back(cmd_line_login_uri); + return; + } for (LLSD::array_iterator llsd_uri = mGridList[mGrid][GRID_LOGIN_URI_VALUE].beginArray(); llsd_uri != mGridList[mGrid][GRID_LOGIN_URI_VALUE].endArray(); llsd_uri++) @@ -531,7 +537,29 @@ void LLGridManager::getLoginURIs(std::vector<std::string>& uris) } } -bool LLGridManager::isInProductionGrid() +std::string LLGridManager::getHelperURI() +{ + std::string cmd_line_helper_uri = gSavedSettings.getString("CmdLineHelperURI"); + if(!cmd_line_helper_uri.empty()) + { + return cmd_line_helper_uri; + } + return mGridList[mGrid][GRID_HELPER_URI_VALUE]; +} + +std::string LLGridManager::getLoginPage() +{ + // override the login page if it was passed in + std::string cmd_line_login_page = gSavedSettings.getString("LoginPage"); + if(!cmd_line_login_page.empty()) + { + return cmd_line_login_page; + } + + return mGridList[mGrid][GRID_LOGIN_PAGE_VALUE]; +} + +bool LLGridManager::LLGridManager::isInProductionGrid() { // *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice, // but it seems that loginURI trumps that. diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h index a99e32f701..8c3a15b7cf 100644 --- a/indra/newview/llviewernetwork.h +++ b/indra/newview/llviewernetwork.h @@ -89,17 +89,7 @@ public: // by default only return the user visible grids std::map<std::string, std::string> getKnownGrids(bool favorites_only=FALSE); - LLSD getGridInfo(const std::string& grid) - { - if(mGridList.has(grid)) - { - return mGridList[grid]; - } - else - { - return LLSD(); - } - } + void getGridInfo(const std::string& grid, LLSD &grid_info); // current grid management @@ -112,8 +102,8 @@ public: std::string getGridLabel() { return mGridList[mGrid][GRID_LABEL_VALUE]; } std::string getGrid() const { return mGrid; } void getLoginURIs(std::vector<std::string>& uris); - std::string getHelperURI() {return mGridList[mGrid][GRID_HELPER_URI_VALUE];} - std::string getLoginPage() {return mGridList[mGrid][GRID_LOGIN_PAGE_VALUE];} + std::string getHelperURI(); + std::string getLoginPage(); std::string getGridLoginID() { return mGridList[mGrid][GRID_ID_VALUE]; } std::string getLoginPage(const std::string& grid) { return mGridList[grid][GRID_LOGIN_PAGE_VALUE]; } void getLoginIdentifierTypes(LLSD& idTypes) { idTypes = mGridList[mGrid][GRID_LOGIN_IDENTIFIER_TYPES]; } @@ -125,7 +115,7 @@ public: std::string getAppSLURLBase(const std::string& grid); std::string getAppSLURLBase() { return getAppSLURLBase(mGrid); } - LLSD getGridInfo() { return mGridList[mGrid]; } + void getGridInfo(LLSD &grid_info) { getGridInfo(mGrid, grid_info); } std::string getGridByLabel( const std::string &grid_label, bool case_sensitive = false); diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index a3b11e706a..5fba5eb69c 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -148,7 +148,8 @@ namespace tut known_grids[std::string("util.agni.lindenlab.com")], std::string("Agni")); ensure_equals("None exists", known_grids[""], "None"); - LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com"); + LLSD grid; + LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com", grid); ensure("Grid info for agni is a map", grid.isMap()); ensure_equals("name is correct for agni", grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com")); @@ -190,7 +191,8 @@ namespace tut // assure Agni doesn't get overwritten - LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com"); + LLSD grid; + LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com", grid); ensure_equals("Agni grid label was not modified by grid file", grid[GRID_LABEL_VALUE].asString(), std::string("Agni")); @@ -215,7 +217,7 @@ namespace tut ensure_equals("Grid file adds to name<->label map", known_grids["grid1"], std::string("mylabel")); - grid = LLGridManager::getInstance()->getGridInfo("grid1"); + LLGridManager::getInstance()->getGridInfo("grid1", grid); ensure_equals("grid file grid name is set", grid[GRID_VALUE].asString(), std::string("grid1")); ensure_equals("grid file label is set", @@ -267,7 +269,7 @@ namespace tut known_grids.size(), 24); ensure_equals("Custom Command line grid is added to the list of grids", known_grids["mycustomgridchoice"], std::string("mycustomgridchoice")); - grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice"); + LLGridManager::getInstance()->getGridInfo("mycustomgridchoice", grid); ensure_equals("Custom Command line grid name is set", grid[GRID_VALUE].asString(), std::string("mycustomgridchoice")); ensure_equals("Custom Command line grid label is set", @@ -298,7 +300,7 @@ namespace tut std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); ensure_equals("Override known grid login uri: No grids are added", known_grids.size(), 23); - grid = LLGridManager::getInstance()->getGridInfo(); + LLGridManager::getInstance()->getGridInfo(grid); ensure("Override known grid login uri: login uri is an array", grid[GRID_LOGIN_URI_VALUE].isArray()); ensure_equals("Override known grid login uri: Command line grid login uri is set", @@ -317,7 +319,7 @@ namespace tut gCmdLineLoginURI = "https://my.login.uri/cgi-bin/login.cgi"; LLGridManager::getInstance()->initialize("grid_test.xml"); known_grids = LLGridManager::getInstance()->getKnownGrids(); - grid = LLGridManager::getInstance()->getGridInfo(); + LLGridManager::getInstance()->getGridInfo(grid); ensure_equals("Override custom grid login uri: Grid is added", known_grids.size(), 24); ensure("Override custom grid login uri: login uri is an array", @@ -347,7 +349,7 @@ namespace tut std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); ensure_equals("Override known grid helper uri: No grids are added", known_grids.size(), 23); - grid = LLGridManager::getInstance()->getGridInfo(); + LLGridManager::getInstance()->getGridInfo(grid); ensure("Override known known helper uri: login uri is an array", grid[GRID_LOGIN_URI_VALUE].isArray()); ensure_equals("Override known grid helper uri: login uri is not changed", @@ -368,7 +370,7 @@ namespace tut known_grids = LLGridManager::getInstance()->getKnownGrids(); ensure_equals("Override custom grid helper uri: grids is added", known_grids.size(), 24); - grid = LLGridManager::getInstance()->getGridInfo(); + LLGridManager::getInstance()->getGridInfo(grid); ensure("Override custom helper uri: login uri is an array", grid[GRID_LOGIN_URI_VALUE].isArray()); ensure_equals("Override custom grid helper uri: login uri is not changed", @@ -396,7 +398,7 @@ namespace tut std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); ensure_equals("Override known grid login page: No grids are added", known_grids.size(), 23); - grid = LLGridManager::getInstance()->getGridInfo(); + LLGridManager::getInstance()->getGridInfo(grid); ensure("Override known grid login page: Command line grid login uri is an array", grid[GRID_LOGIN_URI_VALUE].isArray()); ensure_equals("Override known grid login page: login uri is not changed", @@ -417,7 +419,7 @@ namespace tut known_grids = LLGridManager::getInstance()->getKnownGrids(); ensure_equals("Override custom grid login page: grids are added", known_grids.size(), 24); - grid = LLGridManager::getInstance()->getGridInfo(); + LLGridManager::getInstance()->getGridInfo(grid); ensure("Override custom grid login page: Command line grid login uri is an array", grid[GRID_LOGIN_URI_VALUE].isArray()); ensure_equals("Override custom grid login page: login uri is not changed", @@ -464,7 +466,7 @@ namespace tut ensure("Is myaddedgrid a production grid", !LLGridManager::getInstance()->isInProductionGrid()); LLGridManager::getInstance()->setFavorite(); - grid = LLGridManager::getInstance()->getGridInfo("myaddedgrid"); + LLGridManager::getInstance()->getGridInfo("myaddedgrid", grid); ensure("setting favorite", grid.has(GRID_IS_FAVORITE_VALUE)); } @@ -477,7 +479,7 @@ namespace tut // adding a grid with simply a name will populate the values. grid[GRID_VALUE] = "myaddedgrid"; LLGridManager::getInstance()->addGrid(grid); - grid = LLGridManager::getInstance()->getGridInfo("myaddedgrid"); + LLGridManager::getInstance()->getGridInfo("myaddedgrid", grid); ensure_equals("name based grid has name value", grid[GRID_VALUE].asString(), |