summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/cmd_line.xml34
-rw-r--r--indra/newview/llappviewer.cpp6
-rw-r--r--indra/newview/llappviewerlinux.cpp2
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp2
-rw-r--r--indra/newview/llmarketplacefunctions.cpp8
-rw-r--r--indra/newview/llpanellogin.cpp29
-rw-r--r--indra/newview/llslurl.cpp2
-rw-r--r--indra/newview/llstartup.cpp3
-rw-r--r--indra/newview/llurldispatcher.cpp8
-rw-r--r--indra/newview/llviewernetwork.cpp645
-rw-r--r--indra/newview/llviewernetwork.h206
-rw-r--r--indra/newview/llweb.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml9
-rw-r--r--indra/newview/skins/default/xui/en/panel_login.xml426
-rw-r--r--indra/newview/tests/lllogininstance_test.cpp4
-rw-r--r--indra/newview/tests/llviewernetwork_test.cpp697
16 files changed, 967 insertions, 1118 deletions
diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml
index 15434f2b8f..c02f89dee5 100644
--- a/indra/newview/app_settings/cmd_line.xml
+++ b/indra/newview/app_settings/cmd_line.xml
@@ -45,35 +45,13 @@
<key>grid</key>
<map>
<key>desc</key>
- <string>Specify the name of the grid, local, or an IP address to connect to.</string>
+ <string>Specify the name of the grid to connect to.</string>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>CmdLineGridChoice</string>
</map>
- <key>loginuri</key>
- <map>
- <key>desc</key>
- <string>login server and CGI script to use</string>
- <key>count</key>
- <integer>1</integer>
- <key>compose</key>
- <boolean>true</boolean>
- <key>map-to</key>
- <string>CmdLineLoginURI</string>
- </map>
-
- <key>helperuri</key>
- <map>
- <key>desc</key>
- <string>helper web CGI prefix to use</string>
- <key>count</key>
- <integer>1</integer>
- <key>map-to</key>
- <string>CmdLineHelperURI</string>
- </map>
-
<key>debugviews</key>
<map>
<key>map-to</key>
@@ -377,16 +355,6 @@
<!-- Special case. Not mapped to a setting. -->
</map>
- <key>loginpage</key>
- <map>
- <key>desc</key>
- <string>Login authentication page to use.</string>
- <key>count</key>
- <integer>1</integer>
- <key>map-to</key>
- <string>LoginPage</string>
- </map>
-
<key>qa</key>
<map>
<key>desc</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 1174d108d2..8e9e3d8ad8 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3023,8 +3023,8 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple();
// 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();
+ // which may have been the intended grid.
+ gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridId();
// *FIX:Mani - move this down in llappviewerwin32
#ifdef LL_WINDOWS
@@ -5054,7 +5054,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"] = LLGridManager::getInstance()->getGridId();
query_map["channel"] = LLVersionInfo::getChannel();
// *TODO constantize this guy
// *NOTE: This URL is also used in win_setup/lldownloader.cpp
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index 48d02dfeaa..e8d8efdc0a 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -365,7 +365,7 @@ void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)
const char * cmdargv[] =
{cmd.c_str(),
"-user",
- (char*)LLGridManager::getInstance()->getGridLabel().c_str(),
+ (char*)LLGridManager::getInstance()->getGridId().c_str(),
"-name",
LLAppViewer::instance()->getSecondLifeTitle().c_str(),
NULL};
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 7448f2bb2a..e8cf7d1ba4 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -498,7 +498,7 @@ BOOL LLFloaterModelPreview::postBuild()
text->setMouseDownCallback(boost::bind(&LLModelPreview::setPreviewLOD, mModelPreview, i));
}
}
- std::string current_grid = LLGridManager::getInstance()->getGridLabel();
+ std::string current_grid = LLGridManager::getInstance()->getGridId();
std::transform(current_grid.begin(),current_grid.end(),current_grid.begin(),::tolower);
std::string validate_url;
if (current_grid == "agni")
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index 93dd82957f..1e1243c78a 100644
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -47,16 +47,16 @@ static std::string getMarketplaceDomain()
if (!LLGridManager::getInstance()->isInProductionGrid())
{
- const std::string& grid_label = LLGridManager::getInstance()->getGridLabel();
- const std::string& grid_label_lower = utf8str_tolower(grid_label);
+ const std::string& grid_id = LLGridManager::getInstance()->getGridId();
+ const std::string& grid_id_lower = utf8str_tolower(grid_id);
- if (grid_label_lower == "damballah")
+ if (grid_id_lower == "damballah")
{
domain = "secondlife-staging.com";
}
else
{
- domain = llformat("%s.lindenlab.com", grid_label_lower.c_str());
+ domain = llformat("%s.lindenlab.com", grid_id_lower.c_str());
}
}
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 76aadcd913..6c50a9c374 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -761,7 +761,7 @@ void LLPanelLogin::loadLoginPage()
curl_free(curl_version);
// Grid
- char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLabel().c_str(), 0);
+ char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridId().c_str(), 0);
oStr << "&grid=" << curl_grid;
curl_free(curl_grid);
@@ -828,7 +828,7 @@ void LLPanelLogin::onClickConnect(void *)
catch (LLInvalidGridName ex)
{
LLSD args;
- args["GRID"] = combo_val.asString();
+ args["GRID"] = ex.name();
LLNotificationsUtil::add("InvalidGrid", args);
return;
}
@@ -939,7 +939,11 @@ void LLPanelLogin::updateServer()
}
catch (LLInvalidGridName ex)
{
- // do nothing
+ LL_WARNS("AppInit")<<"server '"<<ex.name()<<"' selection failed"<<LL_ENDL;
+ LLSD args;
+ args["GRID"] = ex.name();
+ LLNotificationsUtil::add("InvalidGrid", args);
+ return;
}
}
@@ -953,14 +957,16 @@ void LLPanelLogin::updateServerCombo()
LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
server_choice_combo->removeall();
- std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(!gSavedSettings.getBOOL("ShowBetaGrids"));
+ std::string current_grid = LLGridManager::getInstance()->getGrid();
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
grid_choice != known_grids.end();
grid_choice++)
{
- if (!grid_choice->first.empty())
+ if (!grid_choice->first.empty() && current_grid != grid_choice->first)
{
+ LL_DEBUGS("AppInit")<<"adding "<<grid_choice->first<<LL_ENDL;
server_choice_combo->add(grid_choice->second, grid_choice->first);
}
}
@@ -968,9 +974,11 @@ void LLPanelLogin::updateServerCombo()
server_choice_combo->addSeparator(ADD_TOP);
+ LL_DEBUGS("AppInit")<<"adding current "<<current_grid<<LL_ENDL;
server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(),
- LLGridManager::getInstance()->getGrid(), ADD_TOP);
-
+ current_grid,
+ ADD_TOP);
+
server_choice_combo->selectFirstItem();
}
@@ -980,7 +988,7 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
// *NOTE: The paramters for this method are ignored.
// LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
// calls this method.
- LL_INFOS("AppInit") << "onSelectServer" << LL_ENDL;
+
// The user twiddled with the grid choice ui.
// apply the selection to the grid setting.
LLPointer<LLCredential> credential;
@@ -991,6 +999,7 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
{
combo_val = combo->getValue();
}
+ LL_INFOS("AppInit") << "onSelectServer "<<combo_val.asString()<< LL_ENDL;
combo = sInstance->getChild<LLComboBox>("start_location_combo");
combo->setCurrentByIndex(1);
@@ -1019,9 +1028,7 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
void LLPanelLogin::updateLoginPanelLinks()
{
- LLSD grid_data;
- LLGridManager::getInstance()->getGridInfo(grid_data);
- bool system_grid = grid_data.has(GRID_IS_SYSTEM_GRID_VALUE);
+ bool system_grid = LLGridManager::getInstance()->isSystemGrid();
// need to call through sInstance, as it's called from onSelectServer, which
// is static.
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index a853726dea..657a261945 100644
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -138,7 +138,7 @@ LLSLURL::LLSLURL(const std::string& slurl)
// so parse the grid name to derive the grid ID
if (!slurl_uri.hostName().empty())
{
- mGrid = LLGridManager::getInstance()->getGridByLabel(slurl_uri.hostName());
+ mGrid = LLGridManager::getInstance()->getGrid(slurl_uri.hostName());
}
else if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
{
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 0ac8c1fe39..f7d1e2a331 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -994,7 +994,7 @@ bool idle_startup()
if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
{
- gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
+ gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridId();
// Update progress status and the display loop.
auth_desc = LLTrans::getString("LoginInProgress");
@@ -1158,7 +1158,6 @@ bool idle_startup()
LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
// create the default proximal channel
LLVoiceChannel::initClass();
- LLGridManager::getInstance()->setFavorite();
LLStartUp::setStartupState( STATE_WORLD_INIT);
}
else
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 4240a38326..f514254f8f 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -211,12 +211,12 @@ 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(), grid_info);
+ std::string grid_label =
+ LLGridManager::getInstance()->getGridLabel(slurl.getGrid());
- if(grid_info.has(GRID_LABEL_VALUE))
+ if(!grid_label.empty())
{
- args["GRID"] = grid_info[GRID_LABEL_VALUE].asString();
+ args["GRID"] = grid_label;
}
else
{
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index ef5c65eb87..b8994d2182 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewernetwork.cpp
* @author James Cook, Richard Nelson
* @brief Networking constants and globals for viewer.
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -34,13 +34,39 @@
#include "lltrans.h"
#include "llweb.h"
-
-const char* DEFAULT_LOGIN_PAGE = "http://viewer-login.agni.lindenlab.com/";
-const char* SYSTEM_GRID_SLURL_BASE = "secondlife://%s/secondlife/";
-const char* MAIN_GRID_SLURL_BASE = "http://maps.secondlife.com/secondlife/";
-const char* SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app";
+/// key used to store the grid, and the name attribute in the grid data
+const std::string GRID_VALUE = "name";
+/// the value displayed in the grid selector menu, and other human-oriented text
+const std::string GRID_LABEL_VALUE = "label";
+/// the value used on the --grid command line argument
+const std::string GRID_ID_VALUE = "grid_login_id";
+/// the url for the login cgi script
+const std::string GRID_LOGIN_URI_VALUE = "login_uri";
+///
+const std::string GRID_HELPER_URI_VALUE = "helper_uri";
+/// the splash page url
+const std::string GRID_LOGIN_PAGE_VALUE = "login_page";
+/// internal data on system grids
+const std::string GRID_IS_SYSTEM_GRID_VALUE = "system_grid";
+/// whether this is single or double names
+const std::string GRID_LOGIN_IDENTIFIER_TYPES = "login_identifier_types";
+
+// defines slurl formats associated with various grids.
+// we need to continue to support existing forms, as slurls
+// are shared between viewers that may not understand newer
+// forms.
+const std::string GRID_SLURL_BASE = "slurl_base";
+const std::string GRID_APP_SLURL_BASE = "app_slurl_base";
+
+const std::string DEFAULT_LOGIN_PAGE = "http://viewer-login.agni.lindenlab.com/";
+
+const std::string MAIN_GRID_LOGIN_URI = "https://login.agni.lindenlab.com/cgi-bin/login.cgi";
+
+const std::string MAIN_GRID_SLURL_BASE = "http://maps.secondlife.com/secondlife/";
+const std::string SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app";
+const char* SYSTEM_GRID_SLURL_BASE = "secondlife://%s/secondlife/";
const char* DEFAULT_SLURL_BASE = "https://%s/region/";
const char* DEFAULT_APP_SLURL_BASE = "x-grid-location-info://%s/app";
@@ -54,14 +80,17 @@ LLGridManager::LLGridManager()
// an attacker. Don't want someone snagging a password.
std::string grid_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
"grids.xml");
+ LL_DEBUGS("GridManager")<<LL_ENDL;
+
initialize(grid_file);
-
+
}
LLGridManager::LLGridManager(const std::string& grid_file)
{
// initialize with an explicity grid file for testing.
+ LL_DEBUGS("GridManager")<<LL_ENDL;
initialize(grid_file);
}
@@ -74,172 +103,62 @@ LLGridManager::LLGridManager(const std::string& grid_file)
//
// LLGridManager::initialze - initialize the list of known grids based
// on the fixed list of linden grids (fixed for security reasons)
-// the grids.xml file
-// and the command line.
+// and the grids.xml file
void LLGridManager::initialize(const std::string& grid_file)
{
// default grid list.
// Don't move to a modifiable file for security reasons,
mGrid.clear() ;
+
// set to undefined
mGridList = LLSD();
mGridFile = grid_file;
// as we don't want an attacker to override our grid list
// to point the default grid to an invalid grid
- addSystemGrid("None", "", "", "", DEFAULT_LOGIN_PAGE);
-
-
-
- addSystemGrid("Agni",
- MAINGRID,
- "https://login.agni.lindenlab.com/cgi-bin/login.cgi",
- "https://secondlife.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Aditi",
- "util.aditi.lindenlab.com",
- "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
+ addSystemGrid("Second Life Main Grid (Agni)",
+ MAINGRID,
+ MAIN_GRID_LOGIN_URI,
+ "https://secondlife.com/helpers/",
+ DEFAULT_LOGIN_PAGE,
+ "Agni");
+ addSystemGrid("Second Life Beta Test Grid (Aditi)",
+ "util.aditi.lindenlab.com",
+ "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
"http://aditi-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Aruna",
- "util.aruna.lindenlab.com",
- "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",
- "http://aruna-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Bharati",
- "util.bharati.lindenlab.com",
- "https://login.bharati.lindenlab.com/cgi-bin/login.cgi",
- "http://bharati-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Chandra",
- "util.chandra.lindenlab.com",
- "https://login.chandra.lindenlab.com/cgi-bin/login.cgi",
- "http://chandra-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Damballah",
- "util.damballah.lindenlab.com",
- "https://login.damballah.lindenlab.com/cgi-bin/login.cgi",
- "http://damballah-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Danu",
- "util.danu.lindenlab.com",
- "https://login.danu.lindenlab.com/cgi-bin/login.cgi",
- "http://danu-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Durga",
- "util.durga.lindenlab.com",
- "https://login.durga.lindenlab.com/cgi-bin/login.cgi",
- "http://durga-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Ganga",
- "util.ganga.lindenlab.com",
- "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",
- "http://ganga-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Mitra",
- "util.mitra.lindenlab.com",
- "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",
- "http://mitra-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Mohini",
- "util.mohini.lindenlab.com",
- "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",
- "http://mohini-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Nandi",
- "util.nandi.lindenlab.com",
- "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",
- "http://nandi-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Parvati",
- "util.parvati.lindenlab.com",
- "https://login.parvati.lindenlab.com/cgi-bin/login.cgi",
- "http://parvati-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Radha",
- "util.radha.lindenlab.com",
- "https://login.radha.lindenlab.com/cgi-bin/login.cgi",
- "http://radha-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Ravi",
- "util.ravi.lindenlab.com",
- "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",
- "http://ravi-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Siva",
- "util.siva.lindenlab.com",
- "https://login.siva.lindenlab.com/cgi-bin/login.cgi",
- "http://siva-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Shakti",
- "util.shakti.lindenlab.com",
- "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",
- "http://shakti-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Soma",
- "util.soma.lindenlab.com",
- "https://login.soma.lindenlab.com/cgi-bin/login.cgi",
- "http://soma-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Uma",
- "util.uma.lindenlab.com",
- "https://login.uma.lindenlab.com/cgi-bin/login.cgi",
- "http://uma-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Vaak",
- "util.vaak.lindenlab.com",
- "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",
- "http://vaak-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Yami",
- "util.yami.lindenlab.com",
- "https://login.yami.lindenlab.com/cgi-bin/login.cgi",
- "http://yami-secondlife.webdev.lindenlab.com/helpers/",
- DEFAULT_LOGIN_PAGE);
- addSystemGrid("Local (Linden)",
- "localhost",
- "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
- "",
- DEFAULT_LOGIN_PAGE);
-
-
+ DEFAULT_LOGIN_PAGE,
+ "Aditi");
+
LLSD other_grids;
llifstream llsd_xml;
if (!grid_file.empty())
{
+ LL_INFOS("GridManager")<<"Grid configuration file '"<<grid_file<<"'"<<LL_ENDL;
llsd_xml.open( grid_file.c_str(), std::ios::in | std::ios::binary );
// parse through the gridfile, inserting grids into the list unless
- // they overwrite a linden grid.
- if( llsd_xml.is_open())
+ // they overwrite an existing grid.
+ if( llsd_xml.is_open())
{
LLSDSerialize::fromXMLDocument( other_grids, llsd_xml );
if(other_grids.isMap())
{
- for(LLSD::map_iterator grid_itr = other_grids.beginMap();
+ for(LLSD::map_iterator grid_itr = other_grids.beginMap();
grid_itr != other_grids.endMap();
++grid_itr)
{
LLSD::String key_name = grid_itr->first;
LLSD grid = grid_itr->second;
- // TODO: Make sure gridfile specified label is not
- // a system grid label
- LL_DEBUGS("GridManager") << "reading: " << key_name << LL_ENDL;
- if (mGridList.has(key_name) &&
- mGridList[key_name].has(GRID_IS_SYSTEM_GRID_VALUE))
+
+ std::string existingGrid = getGrid(grid);
+ if (mGridList.has(key_name) || !existingGrid.empty())
{
- LL_DEBUGS("GridManager") << "Cannot override grid " << key_name << " as it's a system grid" << LL_ENDL;
- // If the system grid does exist in the grids file, and it's marked as a favorite, set it as a favorite.
- if(grid_itr->second.has(GRID_IS_FAVORITE_VALUE) && grid_itr->second[GRID_IS_FAVORITE_VALUE].asBoolean() )
- {
- mGridList[key_name][GRID_IS_FAVORITE_VALUE] = TRUE;
- }
+ LL_WARNS("GridManager") << "Cannot override existing grid '" << key_name << "'; ignoring definition from '"<<grid_file<<"'" << LL_ENDL;
}
else
{
try
{
- addGrid(grid);
- LL_DEBUGS("GridManager") << "Added grid: " << key_name << LL_ENDL;
+ addGrid(grid); // does all the logging that's needed
}
catch (...)
{
@@ -247,10 +166,22 @@ void LLGridManager::initialize(const std::string& grid_file)
}
}
llsd_xml.close();
- }
- }
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"Failed to parse grid configuration '"<<grid_file<<"'"<<LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"Failed to open grid configuration '"<<grid_file<<"'"<<LL_ENDL;
+ }
}
-
+ else
+ {
+ LL_DEBUGS("GridManager")<<"no grid file specified"<<LL_ENDL;
+ }
+
// load a grid from the command line.
// if the actual grid name is specified from the command line,
// set it as the 'selected' grid.
@@ -259,50 +190,38 @@ void LLGridManager::initialize(const std::string& grid_file)
{
// try to find the grid assuming the command line parameter is
// the case-insensitive 'label' of the grid. ie 'Agni'
- mGrid = getGridByLabel(cmd_line_grid);
+ mGrid = getGrid(cmd_line_grid);
if(mGrid.empty())
{
- // if we couldn't find it, assume the
- // requested grid is the actual grid 'name' or index,
- // which would be the dns name of the grid (for non
- // linden hosted grids)
- // If the grid isn't there, that's ok, as it will be
- // automatically added later.
- mGrid = cmd_line_grid;
+ LL_WARNS("GridManager")<<"Unknown grid '"<<cmd_line_grid<<"'"<<LL_ENDL;
+ }
+ else
+ {
+ LL_INFOS("GridManager")<<"Command line specified '"<<cmd_line_grid<<"': "<<mGrid<<LL_ENDL;
}
-
}
else
{
// if a grid was not passed in via the command line, grab it from the CurrentGrid setting.
// if there's no current grid, that's ok as it'll be either set by the value passed
// in via the login uri if that's specified, or will default to maingrid
- mGrid = gSavedSettings.getString("CurrentGrid");
+ std::string last_grid = gSavedSettings.getString("CurrentGrid");
+ if ( ! getGrid(last_grid).empty() )
+ {
+ LL_INFOS("GridManager")<<"Using last grid: "<<last_grid<<LL_ENDL;
+ mGrid = last_grid;
+ }
+ else
+ {
+ LL_INFOS("GridManager")<<"Last grid '"<<last_grid<<"' not configured"<<LL_ENDL;
+ }
}
-
+
if(mGrid.empty())
{
// no grid was specified so default to maingrid
- LL_DEBUGS("GridManager") << "Setting grid to MAINGRID as no grid has been specified " << LL_ENDL;
+ LL_INFOS("GridManager") << "Default grid to "<<MAINGRID<< LL_ENDL;
mGrid = MAINGRID;
-
- }
-
- // generate a 'grid list' entry for any command line parameter overrides
- // or setting overides that we'll add to the grid list or override
- // any grid list entries with.
- LLSD grid = LLSD::emptyMap();
-
- if(mGridList.has(mGrid))
- {
- grid = mGridList[mGrid];
- }
- else
- {
- grid[GRID_VALUE] = mGrid;
- // add the grid with the additional values, or update the
- // existing grid if it exists with the given values
- addGrid(grid);
}
LLControlVariablePtr grid_control = gSavedSettings.getControl("CurrentGrid");
@@ -314,49 +233,13 @@ void LLGridManager::initialize(const std::string& grid_file)
// since above only triggers on changes, trigger the callback manually to initialize state
updateIsInProductionGrid();
- 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_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_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_info[GRID_LOGIN_PAGE_VALUE] = cmd_line_login_page;
- }
-}
-
-
//
// LLGridManager::addGrid - add a grid to the grid list, populating the needed values
// if they're not populated yet.
@@ -366,63 +249,86 @@ void LLGridManager::addGrid(LLSD& grid_data)
{
if (grid_data.isMap() && grid_data.has(GRID_VALUE))
{
- std::string grid = utf8str_tolower(grid_data[GRID_VALUE]);
+ std::string grid = utf8str_tolower(grid_data[GRID_VALUE].asString());
- // grid should be in the form of a dns address
- if (!grid.empty() &&
- grid.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890-_. ") != std::string::npos)
- {
- printf("grid name: %s", grid.c_str());
- throw LLInvalidGridName(grid);
- }
-
- // populate the other values if they don't exist
- if (!grid_data.has(GRID_LABEL_VALUE))
- {
- grid_data[GRID_LABEL_VALUE] = grid;
- }
- if (!grid_data.has(GRID_ID_VALUE))
- {
- grid_data[GRID_ID_VALUE] = grid;
- }
-
- // if the grid data doesn't include any of the URIs, then
- // generate them from the grid, which should be a dns address
- if (!grid_data.has(GRID_LOGIN_URI_VALUE))
- {
- grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
- grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") +
- grid + "/cgi-bin/login.cgi");
- }
- // Populate to the default values
- if (!grid_data.has(GRID_LOGIN_PAGE_VALUE))
+ if ( getGrid(grid_data[GRID_VALUE]).empty() && getGrid(grid).empty() )
{
- grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/";
- }
- if (!grid_data.has(GRID_HELPER_URI_VALUE))
- {
- grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
+ std::string grid_id = grid_data.has(GRID_ID_VALUE) ? grid_data[GRID_ID_VALUE].asString() : "";
+ if ( getGrid(grid_id).empty() )
+ {
+ // populate the other values if they don't exist
+ if (!grid_data.has(GRID_LABEL_VALUE))
+ {
+ grid_data[GRID_LABEL_VALUE] = grid;
+ }
+ if (!grid_data.has(GRID_ID_VALUE))
+ {
+ grid_data[GRID_ID_VALUE] = grid;
+ }
+
+ // if the grid data doesn't include any of the URIs, then
+ // generate them from the grid, which should be a dns address
+ if (!grid_data.has(GRID_LOGIN_URI_VALUE))
+ {
+ grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+ grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") +
+ grid + "/cgi-bin/login.cgi");
+ }
+ // Populate to the default values
+ if (!grid_data.has(GRID_LOGIN_PAGE_VALUE))
+ {
+ grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/";
+ }
+ if (!grid_data.has(GRID_HELPER_URI_VALUE))
+ {
+ grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
+ }
+
+ if (!grid_data.has(GRID_LOGIN_IDENTIFIER_TYPES))
+ {
+ // non system grids and grids that haven't already been configured with values
+ // get both types of credentials.
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT);
+ }
+
+ LL_DEBUGS("GridManager") <<grid<<"\n"
+ <<" id: "<<grid_data[GRID_ID_VALUE].asString()<<"\n"
+ <<" label: "<<grid_data[GRID_LABEL_VALUE].asString()<<"\n"
+ <<" login page: "<<grid_data[GRID_LOGIN_PAGE_VALUE].asString()<<"\n"
+ <<" helper page: "<<grid_data[GRID_HELPER_URI_VALUE].asString()<<"\n";
+ /* still in LL_DEBUGS */
+ for (LLSD::array_const_iterator login_uris = grid_data[GRID_LOGIN_URI_VALUE].beginArray();
+ login_uris != grid_data[GRID_LOGIN_URI_VALUE].endArray();
+ login_uris++)
+ {
+ LL_CONT << " login uri: "<<login_uris->asString()<<"\n";
+ }
+ LL_CONT << LL_ENDL;
+ mGridList[grid] = grid_data;
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"duplicate grid id'"<<grid_id<<"' ignored"<<LL_ENDL;
+ }
}
-
- if (!grid_data.has(GRID_LOGIN_IDENTIFIER_TYPES))
+ else
{
- // non system grids and grids that haven't already been configured with values
- // get both types of credentials.
- grid_data[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
- grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
- grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT);
+ LL_WARNS("GridManager")<<"duplicate grid name '"<<grid<<"' ignored"<<LL_ENDL;
}
-
- LL_DEBUGS("GridManager") << "ADDING: " << grid << LL_ENDL;
- mGridList[grid] = grid_data;
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid value passed"<<LL_ENDL;
}
}
//
// LLGridManager::addSystemGrid - helper for adding a system grid.
-void LLGridManager::addSystemGrid(const std::string& label,
- const std::string& name,
- const std::string& login,
+void LLGridManager::addSystemGrid(const std::string& label,
+ const std::string& name,
+ const std::string& login_uri,
const std::string& helper,
const std::string& login_page,
const std::string& login_id)
@@ -432,12 +338,12 @@ void LLGridManager::addSystemGrid(const std::string& label,
grid[GRID_LABEL_VALUE] = label;
grid[GRID_HELPER_URI_VALUE] = helper;
grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
- grid[GRID_LOGIN_URI_VALUE].append(login);
+ grid[GRID_LOGIN_URI_VALUE].append(login_uri);
grid[GRID_LOGIN_PAGE_VALUE] = login_page;
- grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
+ grid[GRID_IS_SYSTEM_GRID_VALUE] = true;
grid[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
-
+
grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
if (login_id.empty())
{
@@ -447,13 +353,12 @@ void LLGridManager::addSystemGrid(const std::string& label,
{
grid[GRID_ID_VALUE] = login_id;
}
-
+
// only add the system grids beyond agni to the visible list
// if we're building a debug version.
if (name == std::string(MAINGRID))
{
- grid[GRID_SLURL_BASE] = MAIN_GRID_SLURL_BASE;
- grid[GRID_IS_FAVORITE_VALUE] = TRUE;
+ grid[GRID_SLURL_BASE] = MAIN_GRID_SLURL_BASE;
}
else
{
@@ -463,46 +368,39 @@ void LLGridManager::addSystemGrid(const std::string& label,
}
// return a list of grid name -> grid label mappings for UI purposes
-std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
+std::map<std::string, std::string> LLGridManager::getKnownGrids()
{
std::map<std::string, std::string> result;
for(LLSD::map_iterator grid_iter = mGridList.beginMap();
grid_iter != mGridList.endMap();
- grid_iter++)
+ grid_iter++)
{
- if(!favorite_only || grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
- {
- result[grid_iter->first] = grid_iter->second[GRID_LABEL_VALUE].asString();
- }
+ result[grid_iter->first] = grid_iter->second[GRID_LABEL_VALUE].asString();
}
return result;
}
-
void LLGridManager::setGridChoice(const std::string& grid)
{
// Set the grid choice based on a string.
- // The string can be:
- // - a grid label from the gGridInfo table
- // - a hostname
- // - an ip address
+ // The string must be a grid label from the gGridInfo table
// loop through. We could do just a hash lookup but we also want to match
- // on label
+ // on the id
std::string grid_name = grid;
if(!mGridList.has(grid_name))
{
// case insensitive
- grid_name = getGridByLabel(grid);
+ grid_name = getGrid(grid);
}
-
+
if(grid_name.empty())
{
// the grid was not in the list of grids.
LLSD grid_data = LLSD::emptyMap();
grid_data[GRID_VALUE] = grid;
- addGrid(grid_data);
+ addGrid(grid_data);
}
mGrid = grid;
gSavedSettings.setString("CurrentGrid", grid);
@@ -510,61 +408,139 @@ void LLGridManager::setGridChoice(const std::string& grid)
updateIsInProductionGrid();
}
-std::string LLGridManager::getGridByLabel( const std::string &grid_label, bool case_sensitive)
+std::string LLGridManager::getGrid( const std::string &grid )
{
- for(LLSD::map_iterator grid_iter = mGridList.beginMap();
- grid_iter != mGridList.endMap();
- grid_iter++)
+ std::string grid_name;
+
+ if (mGridList.has(grid))
{
- if (grid_iter->second.has(GRID_LABEL_VALUE))
+ // the grid was the long name, so we're good, return it
+ grid_name = grid;
+ }
+ else
+ {
+ // search the grid list for a grid with a matching id
+ for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+ grid_name.empty() && grid_iter != mGridList.endMap();
+ grid_iter++)
{
- if (0 == (case_sensitive?LLStringUtil::compareStrings(grid_label, grid_iter->second[GRID_LABEL_VALUE].asString()):
- LLStringUtil::compareInsensitive(grid_label, grid_iter->second[GRID_LABEL_VALUE].asString())))
+ if (grid_iter->second.has(GRID_ID_VALUE))
{
- return grid_iter->first;
+ if (0 == (LLStringUtil::compareInsensitive(grid,
+ grid_iter->second[GRID_ID_VALUE].asString())))
+ {
+ // found a matching label, return this name
+ grid_name = grid_iter->first;
+ }
}
}
}
- return std::string();
+ return grid_name;
}
-void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
+std::string LLGridManager::getGridLabel(const std::string& grid)
+{
+ std::string grid_label;
+ std::string grid_name = getGrid(grid);
+ if (!grid.empty())
+ {
+ grid_label = mGridList[grid_name][GRID_LABEL_VALUE].asString();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+ LL_DEBUGS("GridManager")<<"returning "<<grid_label<<LL_ENDL;
+ return grid_label;
+}
+
+std::string LLGridManager::getGridId(const std::string& grid)
+{
+ std::string grid_id;
+ std::string grid_name = getGrid(grid);
+ if (!grid.empty())
+ {
+ grid_id = mGridList[grid_name][GRID_ID_VALUE].asString();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+ LL_DEBUGS("GridManager")<<"returning "<<grid_id<<LL_ENDL;
+ return grid_id;
+}
+
+void LLGridManager::getLoginURIs(const std::string& grid, 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;
+ std::string grid_name = getGrid(grid);
+ if (!grid_name.empty())
+ {
+ for (LLSD::array_iterator llsd_uri = mGridList[grid_name][GRID_LOGIN_URI_VALUE].beginArray();
+ llsd_uri != mGridList[grid_name][GRID_LOGIN_URI_VALUE].endArray();
+ llsd_uri++)
+ {
+ uris.push_back(llsd_uri->asString());
+ }
}
- for (LLSD::array_iterator llsd_uri = mGridList[mGrid][GRID_LOGIN_URI_VALUE].beginArray();
- llsd_uri != mGridList[mGrid][GRID_LOGIN_URI_VALUE].endArray();
- llsd_uri++)
+ else
{
- uris.push_back(llsd_uri->asString());
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
}
}
-std::string LLGridManager::getHelperURI()
+void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
+{
+ getLoginURIs(mGrid, uris);
+}
+
+std::string LLGridManager::getHelperURI(const std::string& grid)
+{
+ std::string helper_uri;
+ std::string grid_name = getGrid(grid);
+ if (!grid_name.empty())
+ {
+ helper_uri = mGridList[grid_name][GRID_HELPER_URI_VALUE].asString();
+ }
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+
+ LL_DEBUGS("GridManager")<<"returning "<<helper_uri<<LL_ENDL;
+ return helper_uri;
+}
+
+std::string LLGridManager::getLoginPage(const std::string& grid)
{
- std::string cmd_line_helper_uri = gSavedSettings.getString("CmdLineHelperURI");
- if(!cmd_line_helper_uri.empty())
+ std::string grid_login_page;
+ std::string grid_name = getGrid(grid);
+ if (!grid_name.empty())
{
- return cmd_line_helper_uri;
+ grid_login_page = mGridList[grid_name][GRID_LOGIN_PAGE_VALUE].asString();
}
- return mGridList[mGrid][GRID_HELPER_URI_VALUE];
+ else
+ {
+ LL_WARNS("GridManager")<<"invalid grid '"<<grid<<"'"<<LL_ENDL;
+ }
+ return grid_login_page;
+}
+
+std::string LLGridManager::getLoginPage()
+{
+ std::string login_page = mGridList[mGrid][GRID_LOGIN_PAGE_VALUE].asString();
+ LL_DEBUGS("GridManager")<<"returning "<<login_page<<LL_ENDL;
+ return login_page;
}
-std::string LLGridManager::getLoginPage()
+void LLGridManager::getLoginIdentifierTypes(LLSD& idTypes)
{
- // 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];
+ idTypes = mGridList[mGrid][GRID_LOGIN_IDENTIFIER_TYPES];
+}
+
+std::string LLGridManager::getGridLoginID()
+{
+ return mGridList[mGrid][GRID_ID_VALUE];
}
void LLGridManager::updateIsInProductionGrid()
@@ -578,13 +554,19 @@ void LLGridManager::updateIsInProductionGrid()
if (uris.empty())
{
mIsInProductionGrid = true;
- return;
}
- LLStringUtil::toLower(uris[0]);
- if((uris[0].find("agni") != std::string::npos))
+ else
{
- mIsInProductionGrid = true;
- return;
+ for ( std::vector<std::string>::iterator uri_it = uris.begin();
+ ! mIsInProductionGrid && uri_it != uris.end();
+ uri_it++
+ )
+ {
+ if( MAIN_GRID_LOGIN_URI == *uri_it )
+ {
+ mIsInProductionGrid = true;
+ }
+ }
}
}
@@ -593,25 +575,16 @@ bool LLGridManager::isInProductionGrid()
return mIsInProductionGrid;
}
-void LLGridManager::saveFavorites()
+bool LLGridManager::isSystemGrid(const std::string& grid)
{
- // filter out just those marked as favorites
- LLSD output_grid_list = LLSD::emptyMap();
- for(LLSD::map_iterator grid_iter = mGridList.beginMap();
- grid_iter != mGridList.endMap();
- grid_iter++)
- {
- if(grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
- {
- output_grid_list[grid_iter->first] = grid_iter->second;
- }
- }
- llofstream llsd_xml;
- llsd_xml.open( mGridFile.c_str(), std::ios::out | std::ios::binary);
- LLSDSerialize::toPrettyXML(output_grid_list, llsd_xml);
- llsd_xml.close();
-}
+ std::string grid_name = getGrid(grid);
+ return ( !grid_name.empty()
+ && mGridList.has(grid)
+ && mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE)
+ && mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean()
+ );
+}
// build a slurl for the given region within the selected grid
std::string LLGridManager::getSLURLBase(const std::string& grid)
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index 15e25b4952..802badd494 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -27,113 +27,183 @@
#ifndef LL_LLVIEWERNETWORK_H
#define LL_LLVIEWERNETWORK_H
-
-extern const char* DEFAULT_LOGIN_PAGE;
-
-#define GRID_VALUE "name"
-#define GRID_LABEL_VALUE "label"
-#define GRID_ID_VALUE "grid_login_id"
-#define GRID_LOGIN_URI_VALUE "login_uri"
-#define GRID_HELPER_URI_VALUE "helper_uri"
-#define GRID_LOGIN_PAGE_VALUE "login_page"
-#define GRID_IS_SYSTEM_GRID_VALUE "system_grid"
-#define GRID_IS_FAVORITE_VALUE "favorite"
+
+// @TODO this really should be private, but is used in llslurl
#define MAINGRID "util.agni.lindenlab.com"
-#define GRID_LOGIN_IDENTIFIER_TYPES "login_identifier_types"
-// defines slurl formats associated with various grids.
-// we need to continue to support existing forms, as slurls
-// are shared between viewers that may not understand newer
-// forms.
-#define GRID_SLURL_BASE "slurl_base"
-#define GRID_APP_SLURL_BASE "app_slurl_base"
+/// Exception thrown when a grid is not valid
class LLInvalidGridName
{
public:
LLInvalidGridName(std::string grid) : mGrid(grid)
{
}
+ std::string name() { return mGrid; }
protected:
std::string mGrid;
};
-
/**
- * @brief A class to manage the grids available to the viewer
- * including persistance. This class also maintains the currently
- * selected grid.
- *
+ * @brief A singleton class to manage the grids available to the viewer.
+ *
+ * This class maintains several properties for each known grid, and provides
+ * interfaces for obtaining each of these properties given a specified
+ * grid. Grids are specified by either of two identifiers, each of which
+ * must be unique among all known grids:
+ * - grid name : DNS name for the grid
+ * - grid id : a short form (conventionally a single word)
+ *
+ * This class maintains the currently selected grid, and provides short
+ * form accessors for each of the properties of the selected grid.
**/
class LLGridManager : public LLSingleton<LLGridManager>
{
-public:
-
- // when the grid manager is instantiated, the default grids are automatically
- // loaded, and the grids favorites list is loaded from the xml file.
+ public:
+ /* ================================================================
+ * @name Initialization and Configuration
+ * @{
+ */
+ /// Instantiate the grid manager, load default grids, selects the default grid
LLGridManager(const std::string& grid_file);
LLGridManager();
~LLGridManager();
+ /// add grids from an external grids file
void initialize(const std::string& grid_file);
- // grid list management
- // add a grid to the list of grids
- void addGrid(LLSD& grid_info);
-
- // retrieve a map of grid-name <-> label
- // by default only return the user visible grids
- std::map<std::string, std::string> getKnownGrids(bool favorites_only=FALSE);
-
- void getGridInfo(const std::string& grid, LLSD &grid_info);
+ //@}
- // current grid management
+ /* ================================================================
+ * @name Grid Identifiers
+ * @{
+ * The id is a short form (typically one word) grid name,
+ * It should be used in URL path elements or parameters
+ *
+ * Each grid also has a "label", intented to be a user friendly
+ * descriptive form (it is used in the login panel grid menu, for example).
+ */
+ /// Return the name of a grid, given either its name or its id
+ std::string getGrid( const std::string &grid );
- // select a given grid as the current grid. If the grid
- // is not a known grid, then it's assumed to be a dns name for the
- // grid, and the various URIs will be automatically generated.
- void setGridChoice(const std::string& grid);
+ /// Get the id (short form selector) for a given grid
+ std::string getGridId(const std::string& grid);
+
+ /// Get the id (short form selector) for the selected grid
+ std::string getGridId() { return getGridId(mGrid); }
+
+ /// Get the user-friendly long form descriptor for a given grid
+ std::string getGridLabel(const std::string& grid);
+ /// Get the user-friendly long form descriptor for the selected grid
+ std::string getGridLabel() { return getGridLabel(mGrid); }
+
+ /// Retrieve a map of grid-name -> label
+ std::map<std::string, std::string> getKnownGrids();
+
+ //@}
+
+ /* ================================================================
+ * @name Login related properties
+ * @{
+ */
+
+ /**
+ * Get the login uris for the specified grid.
+ * The login uri for a grid is the target of the authentication request.
+ * A grid may have multple login uris, so they are returned as a vector.
+ */
+ void getLoginURIs(const std::string& grid, std::vector<std::string>& uris);
- std::string getGridLabel() { return mGridList[mGrid][GRID_LABEL_VALUE]; }
- std::string getGrid() const { return mGrid; }
+ /// Get the login uris for the selected grid
void getLoginURIs(std::vector<std::string>& uris);
- 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]; }
- // build a slurl for the given region within the selected grid
+ /// Get the URI for webdev help functions for the specified grid
+ std::string getHelperURI(const std::string& grid);
+
+ /// Get the URI for webdev help functions for the selected grid
+ std::string getHelperURI() { return getHelperURI(mGrid); }
+
+ /// Get the url of the splash page to be displayed prior to login
+ std::string getLoginPage(const std::string& grid_name);
+
+ /// Get the URI for the login splash page for the selected grid
+ std::string getLoginPage();
+
+ /// Get the id to be used as a short name in url path components or parameters
+ std::string getGridLoginID();
+
+ /// Get an array of the login types supported by the grid
+ void getLoginIdentifierTypes(LLSD& idTypes);
+ /**< the types are "agent" and "avatar";
+ * one means single-name (someone Resident) accounts and other first/last name accounts
+ * I am not sure which is which
+ */
+
+ //@}
+
+ /* ================================================================
+ * @name URL Construction Properties
+ * @{
+ */
+
+ /// Return the slurl prefix (everything up to but not including the region) for a given grid
std::string getSLURLBase(const std::string& grid);
+
+ /// Return the slurl prefix (everything up to but not including the region) for the selected grid
std::string getSLURLBase() { return getSLURLBase(mGrid); }
+ /// Return the application URL prefix for the given grid
std::string getAppSLURLBase(const std::string& grid);
+
+ /// Return the application URL prefix for the selected grid
std::string getAppSLURLBase() { return getAppSLURLBase(mGrid); }
-
- void getGridInfo(LLSD &grid_info) { getGridInfo(mGrid, grid_info); }
-
- std::string getGridByLabel( const std::string &grid_label, bool case_sensitive = false);
-
- bool isSystemGrid(const std::string& grid)
- {
- return mGridList.has(grid) &&
- mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE) &&
- mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean();
- }
+
+ //@}
+
+ /* ================================================================
+ * @name Selecting the current grid
+ * @{
+ * At initialization, the current grid is set by the first of:
+ * -# The value supplied by the --grid command line option (setting CmdLineGridChoice);
+ * Note that a default for this may be set at build time.
+ * -# The grid used most recently (setting CurrentGrid)
+ * -# The main grid (Agni)
+ */
+
+ /// Select a given grid as the current grid.
+ void setGridChoice(const std::string& grid);
+
+ /// Returns the name of the currently selected grid
+ std::string getGrid() const { return mGrid; }
+
+ //@}
+
+ /// Is the given grid one of the hard-coded default grids (Agni or Aditi)
+ bool isSystemGrid(const std::string& grid);
+
+ /// Is the selected grid one of the hard-coded default grids (Agni or Aditi)
bool isSystemGrid() { return isSystemGrid(mGrid); }
- // Mark this grid as a favorite that should be persisited on 'save'
- // this is currently used to persist a grid after a successful login
- void setFavorite() { mGridList[mGrid][GRID_IS_FAVORITE_VALUE] = TRUE; }
-
+
+ /// Is the selected grid a production grid?
bool isInProductionGrid();
- void saveFavorites();
- void clearFavorites();
+ /**
+ * yes, that's not a very helpful description.
+ * I don't really know why that is different from isSystemGrid()
+ * In practice, the implementation is that it
+ * @returns true if the login uri for the grid is the uri for MAINGRID
+ */
-protected:
+ private:
+
+ /// Add a grid to the list of grids
+ void addGrid(LLSD& grid_info);
+ /// find the LLSD definition for a given grid
+ void getGridInfo(const std::string& grid, LLSD &grid_info);
+
void updateIsInProductionGrid();
- // helper function for adding the predefined grids
+ // helper function for adding the hard coded grids
void addSystemGrid(const std::string& label,
const std::string& name,
const std::string& login,
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index d2d48dc68f..83337b386d 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -185,8 +185,8 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
substitution["VERSION_PATCH"] = LLVersionInfo::getPatch();
substitution["VERSION_BUILD"] = LLVersionInfo::getBuild();
substitution["CHANNEL"] = LLVersionInfo::getChannel();
- substitution["GRID"] = LLGridManager::getInstance()->getGridLabel();
- substitution["GRID_LOWERCASE"] = utf8str_tolower(LLGridManager::getInstance()->getGridLabel());
+ substitution["GRID"] = LLGridManager::getInstance()->getGridId();
+ substitution["GRID_LOWERCASE"] = utf8str_tolower(LLGridManager::getInstance()->getGridId());
substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
substitution["SESSION_ID"] = gAgent.getSessionID();
substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index afc5b916e7..590707fceb 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -898,7 +898,14 @@ You need an account to enter [SECOND_LIFE]. Would you like to create one now?
You need to enter either the Username or both the First and Last name of your avatar into the Username field, then login again.
</notification>
-
+ <notification
+ icon="alertmodal.tga"
+ name="InvalidGrid"
+ type="alertmodal">
+ <tag>fail</tag>
+'[GRID]' is not a valid grid identifier.
+ </notification>
+
<notification
icon="alertmodal.tga"
name="DeleteClassified"
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index 223326dd06..d227920d9c 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -1,216 +1,216 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
-follows="all"
-height="600"
-layout="topleft"
-left="0"
-name="panel_login"
-focus_root="true"
-top="600"
- width="996">
-<panel.string
- name="create_account_url">
- http://join.secondlife.com/
-</panel.string>
-<string name="reg_in_client_url" translate="false">
- http://secondlife.eniac15.lindenlab.com/reg-in-client/
-</string>
-<panel.string
- name="forgot_password_url">
- http://secondlife.com/account/request.php
-</panel.string>
-<!-- *NOTE: Custom resize logic for login_html in llpanellogin.cpp -->
-<web_browser
- tab_stop="false"
- trusted_content="true"
- bg_opaque_color="Black"
- border_visible="false"
- bottom="600"
- follows="all"
- left="0"
- name="login_html"
- start_url=""
- top="0"
- height="600"
- width="980"/>
-<layout_stack
-follows="left|bottom|right"
-name="login_widgets"
-layout="topleft"
-orientation="horizontal"
-top="519"
-width="996"
-height="80">
-<layout_panel
-auto_resize="false"
-follows="left|bottom"
-name="login"
-layout="topleft"
-width="705"
-min_width="705"
-height="80">
-<text
-follows="left|bottom"
-font="SansSerifSmall"
-height="16"
-name="username_text"
-top="20"
-left="20"
-width="150">
-Username:
-</text>
-<combo_box
-allow_text_entry="true"
-follows="left|bottom"
-height="22"
-left_delta="0"
-max_chars="128"
-combo_editor.prevalidate_callback="ascii"
-tool_tip="The username you chose when you registered, like bobsmith12 or Steller Sunshine"
-top_pad="0"
-name="username_combo"
-width="178">
- <combo_box.combo_button
- visible ="false"/>
- <combo_box.drop_down_button
- visible ="false"/>
-</combo_box>
-<text
-follows="left|bottom"
-font="SansSerifSmall"
-height="15"
-left_pad="-19"
-name="password_text"
-top="20"
- width="150">
- Password:
-</text>
-<line_editor
-follows="left|bottom"
- height="22"
- max_length_bytes="16"
-name="password_edit"
-is_password="true"
-select_on_focus="true"
- top_pad="0"
- width="135" />
- <check_box
-control_name="RememberPassword"
-follows="left|bottom"
-font="SansSerifSmall"
-height="16"
-label="Remember password"
- top_pad="3"
- name="remember_check"
- width="135" />
-<button
- follows="left|bottom"
- height="23"
- image_unselected="PushButton_On"
- image_selected="PushButton_On_Selected"
- label="Log In"
- label_color="White"
- layout="topleft"
- left_pad="10"
- name="connect_btn"
- top="35"
- width="90" />
- <text
- follows="left|bottom"
- font="SansSerifSmall"
- height="15"
- left_pad="8"
- name="start_location_text"
- top="20"
- width="130">
- Start at:
- </text>
-<combo_box
-allow_text_entry="true"
-control_name="NextLoginLocation"
- follows="left|bottom"
- height="23"
-max_chars="128"
-top_pad="0"
-name="start_location_combo"
- width="165">
-<combo_box.item
-label="My last location"
-name="MyLastLocation"
- value="last" />
-<combo_box.item
-label="My home"
-name="MyHome"
- value="home" />
-<combo_box.item
-label="&lt;Type region name&gt;"
-name="Typeregionname" value="" />
-</combo_box>
-<combo_box
-allow_text_entry="true"
-font="SansSerifSmall"
- follows="left|right|bottom"
- height="23"
- max_chars="256"
-layout="topleft"
-top_pad="2"
-name="server_combo"
-width="135"
- visible="false" />
-</layout_panel>
-<layout_panel
-tab_stop="false"
-follows="right|bottom"
-name="links"
-width="205"
-min_width="205"
-height="80">
- <text
-follows="right|bottom"
-font="SansSerifSmall"
-text_color="EmphasisColor"
-halign="right"
-height="16"
-top="12"
-right="-10"
-name="create_new_account_text"
- width="200">
- Sign up
- </text>
-<text
-follows="right|bottom"
-font="SansSerifSmall"
-text_color="EmphasisColor"
-halign="right"
-height="16"
-name="forgot_password_text"
-top_pad="12"
-right="-10"
- width="200">
- Forgot your username or password?
-</text>
-<text
-follows="right|bottom"
-font="SansSerifSmall"
-text_color="EmphasisColor"
-halign="right"
-height="16"
-name="login_help"
-top_pad="2"
-right="-10"
- width="200">
- Need help logging in? </text>
-<!-- <text
- follows="right|bottom"
- font="SansSerifSmall"
- halign="right"
- height="28"
- top_pad="2"
- name="channel_text"
- width="180"
- word_wrap="true">
- [VERSION]
- </text>-->
- </layout_panel>
-</layout_stack>
+ follows="all"
+ height="600"
+ layout="topleft"
+ left="0"
+ name="panel_login"
+ focus_root="true"
+ top="600"
+ width="996">
+ <panel.string
+ name="create_account_url">
+ http://join.secondlife.com/
+ </panel.string>
+ <string name="reg_in_client_url" translate="false">
+ http://secondlife.eniac15.lindenlab.com/reg-in-client/
+ </string>
+ <panel.string
+ name="forgot_password_url">
+ http://secondlife.com/account/request.php
+ </panel.string>
+ <!-- *NOTE: Custom resize logic for login_html in llpanellogin.cpp -->
+ <web_browser
+ tab_stop="false"
+ trusted_content="true"
+ bg_opaque_color="Black"
+ border_visible="false"
+ bottom="600"
+ follows="all"
+ left="0"
+ name="login_html"
+ start_url=""
+ top="0"
+ height="600"
+ width="980"/>
+ <layout_stack
+ follows="left|bottom|right"
+ name="login_widgets"
+ layout="topleft"
+ orientation="horizontal"
+ top="519"
+ width="996"
+ height="80">
+ <layout_panel
+ auto_resize="false"
+ follows="left|bottom"
+ name="login"
+ layout="topleft"
+ width="705"
+ min_width="705"
+ height="80">
+ <text
+ follows="left|bottom"
+ font="SansSerifSmall"
+ height="16"
+ name="username_text"
+ top="20"
+ left="20"
+ width="150">
+ Username:
+ </text>
+ <combo_box
+ allow_text_entry="true"
+ follows="left|bottom"
+ height="22"
+ left_delta="0"
+ max_chars="128"
+ combo_editor.prevalidate_callback="ascii"
+ tool_tip="The username you chose when you registered, like bobsmith12 or Steller Sunshine"
+ top_pad="0"
+ name="username_combo"
+ width="178">
+ <combo_box.combo_button
+ visible ="false"/>
+ <combo_box.drop_down_button
+ visible ="false"/>
+ </combo_box>
+ <text
+ follows="left|bottom"
+ font="SansSerifSmall"
+ height="15"
+ left_pad="-19"
+ name="password_text"
+ top="20"
+ width="150">
+ Password:
+ </text>
+ <line_editor
+ follows="left|bottom"
+ height="22"
+ max_length_bytes="16"
+ name="password_edit"
+ is_password="true"
+ select_on_focus="true"
+ top_pad="0"
+ width="135" />
+ <check_box
+ control_name="RememberPassword"
+ follows="left|bottom"
+ font="SansSerifSmall"
+ height="16"
+ label="Remember password"
+ top_pad="3"
+ name="remember_check"
+ width="135" />
+ <button
+ follows="left|bottom"
+ height="23"
+ image_unselected="PushButton_On"
+ image_selected="PushButton_On_Selected"
+ label="Log In"
+ label_color="White"
+ layout="topleft"
+ left_pad="10"
+ name="connect_btn"
+ top="35"
+ width="90" />
+ <text
+ follows="left|bottom"
+ font="SansSerifSmall"
+ height="15"
+ left_pad="8"
+ name="start_location_text"
+ top="20"
+ width="130">
+ Start at:
+ </text>
+ <combo_box
+ allow_text_entry="true"
+ control_name="NextLoginLocation"
+ follows="left|bottom"
+ height="23"
+ max_chars="128"
+ top_pad="0"
+ name="start_location_combo"
+ width="165">
+ <combo_box.item
+ label="My last location"
+ name="MyLastLocation"
+ value="last" />
+ <combo_box.item
+ label="My home"
+ name="MyHome"
+ value="home" />
+ <combo_box.item
+ label="&lt;Type region name&gt;"
+ name="Typeregionname" value="" />
+ </combo_box>
+ <combo_box
+ allow_text_entry="false"
+ font="SansSerifSmall"
+ follows="left|right|bottom"
+ height="23"
+ max_chars="256"
+ layout="topleft"
+ top_pad="2"
+ name="server_combo"
+ width="250"
+ visible="false" />
+ </layout_panel>
+ <layout_panel
+ tab_stop="false"
+ follows="right|bottom"
+ name="links"
+ width="205"
+ min_width="205"
+ height="80">
+ <text
+ follows="right|bottom"
+ font="SansSerifSmall"
+ text_color="EmphasisColor"
+ halign="right"
+ height="16"
+ top="12"
+ right="-10"
+ name="create_new_account_text"
+ width="200">
+ Sign up
+ </text>
+ <text
+ follows="right|bottom"
+ font="SansSerifSmall"
+ text_color="EmphasisColor"
+ halign="right"
+ height="16"
+ name="forgot_password_text"
+ top_pad="12"
+ right="-10"
+ width="200">
+ Forgot your username or password?
+ </text>
+ <text
+ follows="right|bottom"
+ font="SansSerifSmall"
+ text_color="EmphasisColor"
+ halign="right"
+ height="16"
+ name="login_help"
+ top_pad="2"
+ right="-10"
+ width="200">
+ Need help logging in? </text>
+ <!-- <text
+ follows="right|bottom"
+ font="SansSerifSmall"
+ halign="right"
+ height="28"
+ top_pad="2"
+ name="channel_text"
+ width="180"
+ word_wrap="true">
+ [VERSION]
+ </text>-->
+ </layout_panel>
+ </layout_stack>
</panel>
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index 9e321db889..c9f49d9343 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -136,7 +136,7 @@ void LLGridManager::addSystemGrid(const std::string& label,
const std::string& login_id)
{
}
-std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
+std::map<std::string, std::string> LLGridManager::getKnownGrids()
{
std::map<std::string, std::string> result;
return result;
@@ -151,8 +151,6 @@ bool LLGridManager::isInProductionGrid()
return false;
}
-void LLGridManager::saveFavorites()
-{}
std::string LLGridManager::getSLURLBase(const std::string& grid_name)
{
return "myslurl";
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
index 3c89b64d52..43d3b6522e 100644
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llviewernetwork_test.cpp
* @author Roxie
* @date 2009-03-9
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -31,8 +31,8 @@
#include "../../llxml/llcontrol.h"
#include "llfile.h"
-//----------------------------------------------------------------------------
-// Mock objects for the dependencies of the code we're testing
+//----------------------------------------------------------------------------
+// Mock objects for the dependencies of the code we're testing
LLControlGroup::LLControlGroup(const std::string& name)
: LLInstanceTracker<LLControlGroup, std::string>(name) {}
@@ -81,26 +81,57 @@ LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name)
LLControlGroup gSavedSettings("test");
-const char *gSampleGridFile = "<llsd><map>"
-"<key>grid1</key><map>"
-" <key>favorite</key><integer>1</integer>"
-" <key>helper_uri</key><string>https://helper1/helpers/</string>"
-" <key>label</key><string>mylabel</string>"
-" <key>login_page</key><string>loginpage</string>"
-" <key>login_uri</key><array><string>myloginuri</string></array>"
-" <key>name</key><string>grid1</string>"
-" <key>visible</key><integer>1</integer>"
-" <key>credential_type</key><string>agent</string>"
-" <key>grid_login_id</key><string>MyGrid</string>"
-"</map>"
-"<key>util.agni.lindenlab.com</key><map>"
-" <key>favorite</key><integer>1</integer>"
-" <key>helper_uri</key><string>https://helper1/helpers/</string>"
-" <key>label</key><string>mylabel</string>"
-" <key>login_page</key><string>loginpage</string>"
-" <key>login_uri</key><array><string>myloginuri</string></array>"
-" <key>name</key><string>util.agni.lindenlab.com</string>"
-"</map></map></llsd>";
+const char *gSampleGridFile =
+ "<?xml version=\"1.0\"?>"
+ "<llsd>"
+ " <map>"
+ " <key>altgrid.long.name</key>"
+ " <map>"
+ " <key>helper_uri</key><string>https://helper1/helpers/</string>"
+ " <key>label</key><string>Alternative Grid</string>"
+ " <key>login_page</key><string>altgrid/loginpage</string>"
+ " <key>login_uri</key>"
+ " <array>"
+ " <string>altgrid/myloginuri1</string>"
+ " <string>altgrid/myloginuri2</string>"
+ " </array>"
+ " <key>name</key><string>altgrid.long.name</string>"
+ " <key>credential_type</key><string>agent</string>"
+ " <key>grid_login_id</key><string>AltGrid</string>"
+ " </map>"
+ " <key>minimal.long.name</key>"
+ " <map>"
+ " <key>name</key><string>minimal.long.name</string>"
+ " </map>"
+ " <!-- Note that the values for agni and aditi below are deliberately"
+ " incorrect to test that they are not overwritten -->"
+ " <key>util.agni.lindenlab.com</key> <!-- conflict -->"
+ " <map>"
+ " <key>helper_uri</key><string>https://helper1/helpers/</string>"
+ " <key>grid_login_id</key><string>mylabel</string>"
+ " <key>label</key><string>mylabel</string>"
+ " <key>login_page</key><string>loginpage</string>"
+ " <key>login_uri</key>"
+ " <array>"
+ " <string>myloginuri</string>"
+ " </array>"
+ " <key>name</key><string>util.agni.lindenlab.com</string> <!-- conflict -->"
+ " </map>"
+ " <key>util.foobar.lindenlab.com</key>"
+ " <map>"
+ " <key>helper_uri</key><string>https://helper1/helpers/</string>"
+ " <key>grid_login_id</key><string>Aditi</string> <!-- conflict -->"
+ " <key>label</key><string>mylabel</string>"
+ " <key>login_page</key><string>loginpage</string>"
+ " <key>login_uri</key>"
+ " <array>"
+ " <string>myloginuri</string>"
+ " </array>"
+ " <key>name</key><string>util.foobar.lindenlab.com</string>"
+ " </map>"
+ " </map>"
+ "</llsd>"
+ ;
// -------------------------------------------------------------------------------------------
// TUT
// -------------------------------------------------------------------------------------------
@@ -116,63 +147,89 @@ namespace tut
gCmdLineGridChoice.clear();
gCmdLineHelperURI.clear();
gLoginPage.clear();
- gCurrentGrid.clear();
+ gCurrentGrid.clear();
}
~viewerNetworkTest()
{
LLFile::remove("grid_test.xml");
}
};
-
+
// Tut templating thingamagic: test group, object and test instance
typedef test_group<viewerNetworkTest> viewerNetworkTestFactory;
typedef viewerNetworkTestFactory::object viewerNetworkTestObject;
tut::viewerNetworkTestFactory tut_test("LLViewerNetwork");
-
+
// ---------------------------------------------------------------------------------------
- // Test functions
+ // Test functions
// ---------------------------------------------------------------------------------------
// initialization without a grid file
template<> template<>
void viewerNetworkTestObject::test<1>()
{
-
LLGridManager *manager = LLGridManager::getInstance();
// grid file doesn't exist
manager->initialize("grid_test.xml");
// validate that some of the defaults are available.
std::map<std::string, std::string> known_grids = manager->getKnownGrids();
- ensure_equals("Known grids is a string-string map of size 23", known_grids.size(), 23);
- ensure_equals("Agni has the right name and label",
- 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", 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"));
- ensure_equals("label is correct for agni",
- grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
- ensure("Login URI is an array",
- grid[GRID_LOGIN_URI_VALUE].isArray());
- ensure_equals("Agni login uri is correct",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ ensure_equals("Known grids is a string-string map of size 2", known_grids.size(), 2);
+ ensure_equals("Agni has the right name and label",
+ known_grids[std::string("util.agni.lindenlab.com")],
+ std::string("Second Life Main Grid (Agni)"));
+ ensure_equals("Aditi has the right name and label",
+ known_grids[std::string("util.aditi.lindenlab.com")],
+ std::string("Second Life Beta Test Grid (Aditi)"));
+ ensure_equals("name for agni",
+ LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"),
+ std::string("util.agni.lindenlab.com"));
+ ensure_equals("id for agni",
+ std::string("Agni"),
+ LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"));
+ ensure_equals("label for agni",
+ LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"),
+ std::string("Second Life Main Grid (Agni)"));
+
+ std::vector<std::string> login_uris;
+ LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris);
+ ensure_equals("Number of login uris for agni", 1, login_uris.size());
+ ensure_equals("Agni login uri",
+ login_uris[0],
std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
- ensure_equals("Agni helper uri is correct",
- grid[GRID_HELPER_URI_VALUE].asString(),
+ ensure_equals("Agni helper uri",
+ LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"),
std::string("https://secondlife.com/helpers/"));
- ensure_equals("Agni login page is correct",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
+ ensure_equals("Agni login page",
+ LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"),
std::string("http://viewer-login.agni.lindenlab.com/"));
- ensure("Agni is a favorite",
- grid.has(GRID_IS_FAVORITE_VALUE));
- ensure("Agni is a system grid",
- grid.has(GRID_IS_SYSTEM_GRID_VALUE));
- ensure("Grid file wasn't greated as it wasn't saved",
- !LLFile::isfile("grid_test.xml"));
+ ensure("Agni is a system grid",
+ LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com"));
+
+ ensure_equals("name for aditi",
+ LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"),
+ std::string("util.aditi.lindenlab.com"));
+ ensure_equals("id for aditi",
+ LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"),
+ std::string("Aditi"));
+ ensure_equals("label for aditi",
+ LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"),
+ std::string("Second Life Beta Test Grid (Aditi)"));
+
+ LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris);
+
+ ensure_equals("Number of login uris for aditi", 1, login_uris.size());
+ ensure_equals("Aditi login uri",
+ login_uris[0],
+ std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
+ ensure_equals("Aditi helper uri",
+ LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"),
+ std::string("http://aditi-secondlife.webdev.lindenlab.com/helpers/"));
+ ensure_equals("Aditi login page",
+ LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"),
+ std::string("http://viewer-login.agni.lindenlab.com/"));
+ ensure("Aditi is a system grid",
+ LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com"));
}
-
+
// initialization with a grid file
template<> template<>
void viewerNetworkTestObject::test<2>()
@@ -180,402 +237,172 @@ namespace tut
llofstream gridfile("grid_test.xml");
gridfile << gSampleGridFile;
gridfile.close();
-
+
LLGridManager::getInstance()->initialize("grid_test.xml");
std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure_equals("adding a grid via a grid file increases known grid size",
- known_grids.size(), 24);
- ensure_equals("Agni is still there after we've added a grid via a grid file",
- known_grids["util.agni.lindenlab.com"], std::string("Agni"));
-
-
- // assure Agni doesn't get overwritten
- LLSD grid;
- LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com", grid);
+ ensure_equals("adding a grid via a grid file increases known grid size",4,
+ known_grids.size());
- ensure_equals("Agni grid label was not modified by grid file",
- grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
-
- ensure_equals("Agni name wasn't modified by grid file",
- grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
- ensure("Agni grid URI is still an array after grid file",
- grid[GRID_LOGIN_URI_VALUE].isArray());
- ensure_equals("Agni login uri still the same after grid file",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ // Verify that Agni and Aditi were not overwritten
+ ensure_equals("Agni has the right name and label",
+ known_grids[std::string("util.agni.lindenlab.com")],
+ std::string("Second Life Main Grid (Agni)"));
+ ensure_equals("Aditi has the right name and label",
+ known_grids[std::string("util.aditi.lindenlab.com")],
+ std::string("Second Life Beta Test Grid (Aditi)"));
+ ensure_equals("name for agni",
+ LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"),
+ std::string("util.agni.lindenlab.com"));
+ ensure_equals("id for agni",
+ LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"),
+ std::string("Agni"));
+ ensure_equals("label for agni",
+ LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"),
+ std::string("Second Life Main Grid (Agni)"));
+ std::vector<std::string> login_uris;
+ LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris);
+ ensure_equals("Number of login uris for agni", 1, login_uris.size());
+ ensure_equals("Agni login uri",
+ login_uris[0],
std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
- ensure_equals("Agni helper uri still the same after grid file",
- grid[GRID_HELPER_URI_VALUE].asString(),
+ ensure_equals("Agni helper uri",
+ LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"),
std::string("https://secondlife.com/helpers/"));
- ensure_equals("Agni login page the same after grid file",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
+ ensure_equals("Agni login page",
+ LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"),
std::string("http://viewer-login.agni.lindenlab.com/"));
- ensure("Agni still a favorite after grid file",
- grid.has(GRID_IS_FAVORITE_VALUE));
- ensure("Agni system grid still set after grid file",
- grid.has(GRID_IS_SYSTEM_GRID_VALUE));
-
- ensure_equals("Grid file adds to name<->label map",
- known_grids["grid1"], std::string("mylabel"));
- 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",
- grid[GRID_LABEL_VALUE].asString(), std::string("mylabel"));
- ensure("grid file login uri is an array",
- grid[GRID_LOGIN_URI_VALUE].isArray());
- ensure_equals("grid file login uri is set",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
- std::string("myloginuri"));
- ensure_equals("grid file helper uri is set",
- grid[GRID_HELPER_URI_VALUE].asString(),
- std::string("https://helper1/helpers/"));
- ensure_equals("grid file login page is set",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("loginpage"));
- ensure("grid file favorite is set",
- grid.has(GRID_IS_FAVORITE_VALUE));
- ensure("grid file isn't a system grid",
- !grid.has(GRID_IS_SYSTEM_GRID_VALUE));
- ensure("Grid file still exists after loading",
- LLFile::isfile("grid_test.xml"));
- }
-
- // Initialize via command line
-
- template<> template<>
- void viewerNetworkTestObject::test<3>()
- {
- // USE --grid command line
- // initialize with a known grid
- LLSD grid;
- gCmdLineGridChoice = "Aditi";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- // with single login uri specified.
- std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure_equals("Using a known grid via command line doesn't increase number of known grids",
- known_grids.size(), 23);
- ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Aditi"));
- // initialize with a known grid in lowercase
- gCmdLineGridChoice = "agni";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Agni"));
-
- // now try a command line with a custom grid identifier
- gCmdLineGridChoice = "mycustomgridchoice";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure_equals("adding a command line grid with custom name increases known grid size",
- known_grids.size(), 24);
- ensure_equals("Custom Command line grid is added to the list of grids",
- known_grids["mycustomgridchoice"], std::string("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",
- grid[GRID_LABEL_VALUE].asString(), std::string("mycustomgridchoice"));
- ensure("Custom Command line grid login uri is an array",
- grid[GRID_LOGIN_URI_VALUE].isArray());
- ensure_equals("Custom Command line grid login uri is set",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
- std::string("https://mycustomgridchoice/cgi-bin/login.cgi"));
- ensure_equals("Custom Command line grid helper uri is set",
- grid[GRID_HELPER_URI_VALUE].asString(),
- std::string("https://mycustomgridchoice/helpers/"));
- ensure_equals("Custom Command line grid login page is set",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("http://mycustomgridchoice/app/login/"));
- }
-
- // validate override of login uri with cmd line
- template<> template<>
- void viewerNetworkTestObject::test<4>()
- {
- // Override with loginuri
- // override known grid
- LLSD grid;
- gCmdLineGridChoice = "Aditi";
- gCmdLineLoginURI = "https://my.login.uri/cgi-bin/login.cgi";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- 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);
- 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",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
- std::string("https://my.login.uri/cgi-bin/login.cgi"));
- ensure_equals("Override known grid login uri: helper uri is not changed",
- grid[GRID_HELPER_URI_VALUE].asString(),
- std::string("http://aditi-secondlife.webdev.lindenlab.com/helpers/"));
- ensure_equals("Override known grid login uri: login page is not set",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("http://viewer-login.agni.lindenlab.com/"));
-
- // Override with loginuri
- // override custom grid
- gCmdLineGridChoice = "mycustomgridchoice";
- gCmdLineLoginURI = "https://my.login.uri/cgi-bin/login.cgi";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- known_grids = LLGridManager::getInstance()->getKnownGrids();
- 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",
- grid[GRID_LOGIN_URI_VALUE].isArray());
- ensure_equals("Override custom grid login uri: login uri is set",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
- std::string("https://my.login.uri/cgi-bin/login.cgi"));
- ensure_equals("Override custom grid login uri: Helper uri is not set",
- grid[GRID_HELPER_URI_VALUE].asString(),
- std::string("https://mycustomgridchoice/helpers/"));
- ensure_equals("Override custom grid login uri: Login page is not set",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("http://mycustomgridchoice/app/login/"));
- }
-
- // validate override of helper uri with cmd line
- template<> template<>
- void viewerNetworkTestObject::test<5>()
- {
- // Override with helperuri
- // override known grid
- LLSD grid;
- gCmdLineGridChoice = "Aditi";
- gCmdLineLoginURI = "";
- gCmdLineHelperURI = "https://my.helper.uri/mycustomhelpers";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- 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);
- 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",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
- std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
- ensure_equals("Override known grid helper uri: helper uri is changed",
- grid[GRID_HELPER_URI_VALUE].asString(),
- std::string("https://my.helper.uri/mycustomhelpers"));
- ensure_equals("Override known grid helper uri: login page is not changed",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("http://viewer-login.agni.lindenlab.com/"));
-
- // Override with helperuri
- // override custom grid
- gCmdLineGridChoice = "mycustomgridchoice";
- gCmdLineHelperURI = "https://my.helper.uri/mycustomhelpers";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure_equals("Override custom grid helper uri: grids is added",
- known_grids.size(), 24);
- 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",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
- std::string("https://mycustomgridchoice/cgi-bin/login.cgi"));
- ensure_equals("Override custom grid helper uri: helper uri is changed",
- grid[GRID_HELPER_URI_VALUE].asString(),
- std::string("https://my.helper.uri/mycustomhelpers"));
- ensure_equals("Override custom grid helper uri: login page is not changed",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("http://mycustomgridchoice/app/login/"));
- }
-
- // validate overriding of login page via cmd line
- template<> template<>
- void viewerNetworkTestObject::test<6>()
- {
- // Override with login page
- // override known grid
- LLSD grid;
- gCmdLineGridChoice = "Aditi";
- gCmdLineHelperURI = "";
- gLoginPage = "myloginpage";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- 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);
- 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",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
+ ensure("Agni is a system grid",
+ LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com"));
+
+ ensure_equals("name for aditi",
+ LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"),
+ std::string("util.aditi.lindenlab.com"));
+ ensure_equals("id for aditi",
+ LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"),
+ std::string("Aditi"));
+ ensure_equals("label for aditi",
+ LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"),
+ std::string("Second Life Beta Test Grid (Aditi)"));
+
+ LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris);
+ ensure_equals("Number of login uris for aditi", 1, login_uris.size());
+ ensure_equals("Aditi login uri",
+ login_uris[0],
std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
- ensure_equals("Override known grid login page: helper uri is not changed",
- grid[GRID_HELPER_URI_VALUE].asString(),
+ ensure_equals("Aditi helper uri",
+ LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"),
std::string("http://aditi-secondlife.webdev.lindenlab.com/helpers/"));
- ensure_equals("Override known grid login page: login page is changed",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("myloginpage"));
-
- // Override with login page
- // override custom grid
- gCmdLineGridChoice = "mycustomgridchoice";
- gLoginPage = "myloginpage";
- LLGridManager::getInstance()->initialize("grid_test.xml");
- known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure_equals("Override custom grid login page: grids are added",
- known_grids.size(), 24);
- 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",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
- std::string("https://mycustomgridchoice/cgi-bin/login.cgi"));
- ensure_equals("Override custom grid login page: helper uri is not changed",
- grid[GRID_HELPER_URI_VALUE].asString(),
- std::string("https://mycustomgridchoice/helpers/"));
- ensure_equals("Override custom grid login page: login page is changed",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("myloginpage"));
-
+ ensure_equals("Aditi login page",
+ LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"),
+ std::string("http://viewer-login.agni.lindenlab.com/"));
+ ensure("Aditi is a system grid",
+ LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com"));
+
+ // Check the additional grid from the file
+ ensure_equals("alternative grid is in name<->label map",
+ known_grids["altgrid.long.name"],
+ std::string("Alternative Grid"));
+ ensure_equals("alternative grid name is set",
+ LLGridManager::getInstance()->getGrid("altgrid.long.name"),
+ std::string("altgrid.long.name"));
+ ensure_equals("alternative grid id",
+ LLGridManager::getInstance()->getGridId("altgrid.long.name"),
+ std::string("AltGrid"));
+ ensure_equals("alternative grid label",
+ LLGridManager::getInstance()->getGridLabel("altgrid.long.name"),
+ std::string("Alternative Grid"));
+ std::vector<std::string> alt_login_uris;
+ LLGridManager::getInstance()->getLoginURIs(std::string("altgrid.long.name"), alt_login_uris);
+ ensure_equals("Number of login uris for altgrid", 2, alt_login_uris.size());
+ ensure_equals("alternative grid first login uri",
+ alt_login_uris[0],
+ std::string("altgrid/myloginuri1"));
+ ensure_equals("alternative grid second login uri",
+ alt_login_uris[1],
+ std::string("altgrid/myloginuri2"));
+ ensure_equals("alternative grid helper uri",
+ LLGridManager::getInstance()->getHelperURI("altgrid.long.name"),
+ std::string("https://helper1/helpers/"));
+ ensure_equals("alternative grid login page",
+ LLGridManager::getInstance()->getLoginPage("altgrid.long.name"),
+ std::string("altgrid/loginpage"));
+ ensure("alternative grid is NOT a system grid",
+ ! LLGridManager::getInstance()->isSystemGrid("altgrid.long.name"));
+
+ ensure_equals("minimal grid is in name<->label map",
+ known_grids["minimal.long.name"],
+ std::string("minimal.long.name"));
+ ensure_equals("minimal grid name is set",
+ LLGridManager::getInstance()->getGrid("minimal.long.name"),
+ std::string("minimal.long.name"));
+ ensure_equals("minimal grid id",
+ LLGridManager::getInstance()->getGridId("minimal.long.name"),
+ std::string("minimal.long.name"));
+ ensure_equals("minimal grid label",
+ LLGridManager::getInstance()->getGridLabel("minimal.long.name"),
+ std::string("minimal.long.name"));
+
+ LLGridManager::getInstance()->getLoginURIs(std::string("minimal.long.name"), alt_login_uris);
+ ensure_equals("Number of login uris for altgrid", 1, alt_login_uris.size());
+ ensure_equals("minimal grid login uri",
+ alt_login_uris[0],
+ std::string("https://minimal.long.name/cgi-bin/login.cgi"));
+ ensure_equals("minimal grid helper uri",
+ LLGridManager::getInstance()->getHelperURI("minimal.long.name"),
+ std::string("https://minimal.long.name/helpers/"));
+ ensure_equals("minimal grid login page",
+ LLGridManager::getInstance()->getLoginPage("minimal.long.name"),
+ std::string("http://minimal.long.name/app/login/"));
+
}
-
+
+
// validate grid selection
template<> template<>
void viewerNetworkTestObject::test<7>()
- {
- LLSD loginURI = LLSD::emptyArray();
- LLSD grid = LLSD::emptyMap();
+ {
// adding a grid with simply a name will populate the values.
- grid[GRID_VALUE] = "myaddedgrid";
+ llofstream gridfile("grid_test.xml");
+ gridfile << gSampleGridFile;
+ gridfile.close();
LLGridManager::getInstance()->initialize("grid_test.xml");
- LLGridManager::getInstance()->addGrid(grid);
- LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
- ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Agni"));
- ensure_equals("getGrid", LLGridManager::getInstance()->getGrid(),
+
+ LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
+ ensure_equals("getGridLabel",
+ LLGridManager::getInstance()->getGridLabel(),
+ std::string("Second Life Main Grid (Agni)"));
+ ensure_equals("getGridId",
+ LLGridManager::getInstance()->getGridId(),
+ std::string("Agni"));
+ ensure_equals("getGrid",
+ LLGridManager::getInstance()->getGrid(),
std::string("util.agni.lindenlab.com"));
- ensure_equals("getHelperURI", LLGridManager::getInstance()->getHelperURI(),
+ ensure_equals("getHelperURI",
+ LLGridManager::getInstance()->getHelperURI(),
std::string("https://secondlife.com/helpers/"));
- ensure_equals("getLoginPage", LLGridManager::getInstance()->getLoginPage(),
+ ensure_equals("getLoginPage",
+ LLGridManager::getInstance()->getLoginPage(),
std::string("http://viewer-login.agni.lindenlab.com/"));
- ensure_equals("getLoginPage2", LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"),
- std::string("http://viewer-login.agni.lindenlab.com/"));
- ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid());
+ ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid());
std::vector<std::string> uris;
LLGridManager::getInstance()->getLoginURIs(uris);
- ensure_equals("getLoginURIs size", uris.size(), 1);
- ensure_equals("getLoginURIs", uris[0],
+ ensure_equals("getLoginURIs size", 1, uris.size());
+ ensure_equals("getLoginURIs",
+ uris[0],
std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
- LLGridManager::getInstance()->setGridChoice("myaddedgrid");
- ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("myaddedgrid"));
- ensure("Is myaddedgrid a production grid", !LLGridManager::getInstance()->isInProductionGrid());
-
- LLGridManager::getInstance()->setFavorite();
- LLGridManager::getInstance()->getGridInfo("myaddedgrid", grid);
- ensure("setting favorite", grid.has(GRID_IS_FAVORITE_VALUE));
- }
-
- // name based grid population
- template<> template<>
- void viewerNetworkTestObject::test<8>()
- {
- LLGridManager::getInstance()->initialize("grid_test.xml");
- LLSD grid = LLSD::emptyMap();
- // adding a grid with simply a name will populate the values.
- grid[GRID_VALUE] = "myaddedgrid";
- LLGridManager::getInstance()->addGrid(grid);
- LLGridManager::getInstance()->getGridInfo("myaddedgrid", grid);
-
- ensure_equals("name based grid has name value",
- grid[GRID_VALUE].asString(),
- std::string("myaddedgrid"));
- ensure_equals("name based grid has label value",
- grid[GRID_LABEL_VALUE].asString(),
- std::string("myaddedgrid"));
- ensure_equals("name based grid has name value",
- grid[GRID_HELPER_URI_VALUE].asString(),
- std::string("https://myaddedgrid/helpers/"));
- ensure_equals("name based grid has name value",
- grid[GRID_LOGIN_PAGE_VALUE].asString(),
- std::string("http://myaddedgrid/app/login/"));
- ensure("name based grid has array loginuri",
- grid[GRID_LOGIN_URI_VALUE].isArray());
- ensure_equals("name based grid has single login uri value",
- grid[GRID_LOGIN_URI_VALUE].size(), 1);
- ensure_equals("Name based grid login uri is correct",
- grid[GRID_LOGIN_URI_VALUE][0].asString(),
- std::string("https://myaddedgrid/cgi-bin/login.cgi"));
- ensure("name based grid is not a favorite yet",
- !grid.has(GRID_IS_FAVORITE_VALUE));
- ensure("name based grid does not have system setting",
- !grid.has(GRID_IS_SYSTEM_GRID_VALUE));
-
- llofstream gridfile("grid_test.xml");
- gridfile << gSampleGridFile;
- gridfile.close();
- }
-
- // persistence of the grid list with an empty gridfile.
- template<> template<>
- void viewerNetworkTestObject::test<9>()
- {
- // try with initial grid list without a grid file,
- // without setting the grid to a saveable favorite.
- LLGridManager::getInstance()->initialize("grid_test.xml");
- LLSD grid = LLSD::emptyMap();
- grid[GRID_VALUE] = std::string("mynewgridname");
- LLGridManager::getInstance()->addGrid(grid);
- LLGridManager::getInstance()->saveFavorites();
- ensure("Grid file exists after saving",
- LLFile::isfile("grid_test.xml"));
- LLGridManager::getInstance()->initialize("grid_test.xml");
- // should not be there
- std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure("New grid wasn't added to persisted list without being marked a favorite",
- known_grids.find(std::string("mynewgridname")) == known_grids.end());
-
- // mark a grid a favorite to make sure it's persisted
- LLGridManager::getInstance()->addGrid(grid);
- LLGridManager::getInstance()->setGridChoice("mynewgridname");
- LLGridManager::getInstance()->setFavorite();
- LLGridManager::getInstance()->saveFavorites();
- ensure("Grid file exists after saving",
- LLFile::isfile("grid_test.xml"));
- LLGridManager::getInstance()->initialize("grid_test.xml");
- // should not be there
- known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure("New grid wasn't added to persisted list after being marked a favorite",
- known_grids.find(std::string("mynewgridname")) !=
- known_grids.end());
- }
-
- // persistence of the grid file with existing gridfile
- template<> template<>
- void viewerNetworkTestObject::test<10>()
- {
-
- llofstream gridfile("grid_test.xml");
- gridfile << gSampleGridFile;
- gridfile.close();
-
- LLGridManager::getInstance()->initialize("grid_test.xml");
- LLSD grid = LLSD::emptyMap();
- grid[GRID_VALUE] = std::string("mynewgridname");
- LLGridManager::getInstance()->addGrid(grid);
- LLGridManager::getInstance()->saveFavorites();
- // validate we didn't lose existing favorites
- LLGridManager::getInstance()->initialize("grid_test.xml");
- std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure("New grid wasn't added to persisted list after being marked a favorite",
- known_grids.find(std::string("grid1")) !=
- known_grids.end());
-
- // add a grid
- LLGridManager::getInstance()->addGrid(grid);
- LLGridManager::getInstance()->setGridChoice("mynewgridname");
- LLGridManager::getInstance()->setFavorite();
- LLGridManager::getInstance()->saveFavorites();
- known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure("New grid wasn't added to persisted list after being marked a favorite",
- known_grids.find(std::string("grid1")) !=
- known_grids.end());
- known_grids = LLGridManager::getInstance()->getKnownGrids();
- ensure("New grid wasn't added to persisted list after being marked a favorite",
- known_grids.find(std::string("mynewgridname")) !=
- known_grids.end());
+
+ LLGridManager::getInstance()->setGridChoice("altgrid.long.name");
+ ensure_equals("getGridLabel",
+ LLGridManager::getInstance()->getGridLabel(),
+ std::string("Alternative Grid"));
+ ensure_equals("getGridId",
+ LLGridManager::getInstance()->getGridId(),
+ std::string("AltGrid"));
+ ensure("alternative grid is not a system grid",
+ !LLGridManager::getInstance()->isSystemGrid());
+ ensure("alternative grid is not a production grid",
+ !LLGridManager::getInstance()->isInProductionGrid());
}
+
}