//static void HippoGridInfo::onXmlCharacterData(void* userData, const XML_Char* s, int len) { HippoGridInfo* self = (HippoGridInfo*)userData; switch (self->mXmlState) { case XML_GRIDNICK: { if (self->mGridNick == "") { self->mGridNick.assign(s, len); self->mGridNick = sanitizeGridNick(self->mGridNick); } break; } case XML_PLATFORM: { std::string platform(s, len); self->setPlatform(platform); break; } case XML_LOGINURI: { self->setLoginUri(std::string(s, len)); break; } case XML_HELPERURI: { self->setHelperUri(std::string(s, len)); break; } case XML_SEARCH: { self->mSearchUrl.assign(s, len); //sanitizeQueryUrl(mSearchUrl); break; } case XML_GRIDNAME: { if (self->mGridName == "") { self->mGridName.assign(s, len); } break; } case XML_LOGINPAGE: self->mLoginPage.assign(s, len); break; case XML_WEBSITE: self->mWebSite.assign(s, len); break; case XML_SUPPORT: self->mSupportUrl.assign(s, len); break; case XML_REGISTER: self->mRegisterUrl.assign(s, len); break; case XML_PASSWORD: self->mPasswordUrl.assign(s, len); break; case XML_MESSAGE: self->mGridMessage.assign(s, len); break; case XML_VOID: break; } }
// static void LLPanelLogin::updateGridCombo(std::string grid_nick) { LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); if (grid_nick.empty()) { // The user twiddled with the grid choice ui. // apply the selection to the grid setting. //std::string grid_label; //S32 grid_index; grid_nick = combo->getValue().asString(); HippoGridInfo *gridInfo = gHippoGridManager->getGrid(grid_nick); if (gridInfo) { //childSetText("gridnick", gridInfo->getGridNick()); //platform->setCurrentByIndex(gridInfo->getPlatform()); //childSetText("gridname", gridInfo->getGridName()); LLPanelLogin::setFields( gridInfo->getFirstName(), gridInfo->getLastName(), gridInfo->getAvatarPassword()); } } else { combo->setSimple(grid_nick); } gHippoGridManager->setCurrentGrid(grid_nick); llinfos << "current grid set to " << grid_nick << llendl; // grid changed so show new splash screen (possibly) loadLoginPage(); // save grid choice to settings gSavedSettings.setString("LastSelectedGrid", grid_nick); }
void HippoPanelGridsImpl::retrieveGridInfo() { std::string loginuri = childGetValue("loginuri"); if ((loginuri == "") || (loginuri == "<required>")) { LLNotificationsUtil::add("GridInfoNoLoginUri"); return; } HippoGridInfo *grid = 0; bool cleanupGrid = false; if (mState == NORMAL) { grid = gHippoGridManager->getGrid(mCurGrid); } else if ((mState == ADD_NEW) || (mState == ADD_COPY)) { grid = new HippoGridInfo(""); cleanupGrid = true; } else { llerrs << "Illegal state " << mState << '.' << llendl; return; } if (!grid) { llerrs << "Internal error retrieving grid info." << llendl; return; } grid->setLoginUri(loginuri); if (grid->retrieveGridInfo()) { if (grid->getPlatform() != HippoGridInfo::PLATFORM_OTHER) getChild<LLComboBox>("platform")->setCurrentByIndex(grid->getPlatform()); if (grid->getGridName() != "") childSetText("gridname", grid->getGridName()); if (grid->getLoginUri() != "") childSetText("loginuri", grid->getLoginUri()); if (grid->getLoginPage() != "") childSetText("loginpage", grid->getLoginPage()); if (grid->getHelperUri() != "") childSetText("helperuri", grid->getHelperUri()); if (grid->getWebSite() != "") childSetText("website", grid->getWebSite()); if (grid->getSupportUrl() != "") childSetText("support", grid->getSupportUrl()); if (grid->getRegisterUrl() != "") childSetText("register", grid->getRegisterUrl()); if (grid->getPasswordUrl() != "") childSetText("password", grid->getPasswordUrl()); if (grid->getSearchUrl() != "") childSetText("search", grid->getSearchUrl()); if (grid->getGridMessage() != "") childSetText("gridmessage", grid->getGridMessage()); } else { LLNotificationsUtil::add("GridInfoError"); } if (cleanupGrid) delete grid; }
// returns false, if adding new grid failed bool HippoPanelGridsImpl::saveCurGrid() { HippoGridInfo *gridInfo = 0; gridInfo = gHippoGridManager->getGrid(mCurGrid); //gridInfo->retrieveGridInfo(); refresh(); std::string gridname = childGetValue("gridname"); if (gridname == "<required>") gridname = ""; std::string loginuri = childGetValue("loginuri"); if (loginuri == "<required>") loginuri = ""; if (gridname.empty() && !loginuri.empty()) this->retrieveGridInfo(); if ((mState == ADD_NEW) || (mState == ADD_COPY)) { // check nickname std::string gridname = childGetValue("gridname"); childSetValue("gridname", (gridname != "")? gridname: "<required>"); if (gridname == "") { LLNotificationsUtil::add("GridsNoNick"); return false; } if (gHippoGridManager->getGrid(gridname)) { LLSD args; args["NAME"] = gridname; LLNotificationsUtil::add("GridExists", args); return false; } // check login URI if (loginuri == "") { LLSD args; args["NAME"] = gridname; LLNotificationsUtil::add("GridsNoLoginUri", args); return false; } mState = NORMAL; mCurGrid = gridname; gridInfo = new HippoGridInfo(gridname); gHippoGridManager->addGrid(gridInfo); gridInfo->retrieveGridInfo(); } if (!gridInfo) { llwarns << "Grid not found, ignoring changes." << llendl; return true; } gridInfo->setPlatform(childGetValue("platform")); gridInfo->setGridName(childGetValue("gridname")); gridInfo->setLoginUri(childGetValue("loginuri")); gridInfo->setLoginPage(childGetValue("loginpage")); gridInfo->setHelperUri(childGetValue("helperuri")); gridInfo->setWebSite(childGetValue("website")); gridInfo->setSupportUrl(childGetValue("support")); gridInfo->setRegisterUrl(childGetValue("register")); gridInfo->setPasswordUrl(childGetValue("password")); gridInfo->setSearchUrl(childGetValue("search")); gridInfo->setRenderCompat(childGetValue("render_compat")); refresh(); return true; }
void HippoPanelGridsImpl::loadCurGrid() { HippoGridInfo *gridInfo = gHippoGridManager->getGrid(mCurGrid); if (gridInfo && (mState != ADD_NEW)) { LLComboBox *platform = getChild<LLComboBox>("platform"); if (platform) platform->setCurrentByIndex(gridInfo->getPlatform()); childSetText("gridname", gridInfo->getGridName()); childSetText("loginuri", gridInfo->getLoginUri()); childSetText("loginpage", gridInfo->getLoginPage()); childSetText("helperuri", gridInfo->getHelperUri()); childSetText("website", gridInfo->getWebSite()); childSetText("support", gridInfo->getSupportUrl()); childSetText("register", gridInfo->getRegisterUrl()); childSetText("password", gridInfo->getPasswordUrl()); childSetValue("render_compat", gridInfo->isRenderCompat()); } else { std::string empty = ""; LLComboBox *platform = getChild<LLComboBox>("platform"); if (platform) platform->setCurrentByIndex(HippoGridInfo::PLATFORM_OTHER); childSetText("gridname", empty); childSetText("loginuri", empty); childSetText("loginpage", empty); childSetText("helperuri", empty); childSetText("website", empty); childSetText("support", empty); childSetText("register", empty); childSetText("password", empty); childSetEnabled("render_compat", true); childSetValue("render_compat", true); } if (mState == ADD_NEW) { std::string required = "<required>"; childSetText("gridname", required); childSetText("loginuri", required); } else if (mState == ADD_COPY) { childSetText("gridname", std::string("<required>")); } else if (mState != NORMAL) { llwarns << "Illegal state " << mState << '.' << llendl; } refresh(); }
// returns false, if adding new grid failed bool HippoPanelGridsImpl::saveCurGrid() { HippoGridInfo *gridInfo = 0; gridInfo = gHippoGridManager->getGrid(mCurGrid); //gridInfo->getGridInfo(); refresh(); std::string gridname = childGetValue("gridname"); if (gridname == "<required>") gridname = ""; std::string loginuri = childGetValue("loginuri"); if (loginuri == "<required>") loginuri = ""; if (gridname.empty() && !loginuri.empty()) this->retrieveGridInfo(); if ((mState == ADD_NEW) || (mState == ADD_COPY)) { // check nickname std::string gridname = childGetValue("gridname"); childSetValue("gridname", (gridname != "")? gridname: "<required>"); if (gridname == "") { LLNotificationsUtil::add("GridsNoNick"); return false; } if (gHippoGridManager->getGrid(gridname)) { LLSD args; args["NAME"] = gridname; LLNotificationsUtil::add("GridExists", args); return false; } // check login URI if (loginuri == "") { LLSD args; args["NAME"] = gridname; LLNotificationsUtil::add("GridsNoLoginUri", args); return false; } mState = NORMAL; mCurGrid = gridname; gridInfo = new HippoGridInfo(gridname); gHippoGridManager->addGrid(gridInfo); try { gridInfo->getGridInfo(); } catch (AIAlert::ErrorCode const& error) { if (error.getCode() == HTTP_NOT_FOUND || error.getCode() == HTTP_METHOD_NOT_ALLOWED) { // Ignore this error; it might be a user entered entry for a grid that has no get_grid_info support. llwarns << AIAlert::text(error) << llendl; } else if (error.getCode() == HTTP_OK) { // XML parse error. AIAlert::add("GridInfoError", error); } else { // Append GridInfoErrorInstruction to error message. AIAlert::add("GridInfoError", AIAlert::Error(AIAlert::Prefix(), AIAlert::not_modal, error, "GridInfoErrorInstruction")); } } } if (!gridInfo) { llwarns << "Grid not found, ignoring changes." << llendl; return true; } gridInfo->setPlatform(childGetValue("platform")); gridInfo->setGridName(childGetValue("gridname")); gridInfo->setLoginUri(childGetValue("loginuri")); gridInfo->setLoginPage(childGetValue("loginpage")); gridInfo->setHelperUri(childGetValue("helperuri")); gridInfo->setWebSite(childGetValue("website")); gridInfo->setSupportUrl(childGetValue("support")); gridInfo->setRegisterUrl(childGetValue("register")); gridInfo->setPasswordUrl(childGetValue("password")); gridInfo->setSearchUrl(childGetValue("search")); gridInfo->setRenderCompat(childGetValue("render_compat")); refresh(); return true; }
void HippoGridManager::saveFile() { // save default grid to client settings gSavedSettings.setString("DefaultGrid", mDefaultGrid); // build LLSD LLSD gridInfo; gridInfo[0]["default_grids_version"] = mDefaultGridsVersion; // add grids S32 i = 1; GridIterator it, end = mGridInfo.end(); for (it = mGridInfo.begin(); it != end; ++it, i++) { HippoGridInfo *grid = it->second; gridInfo[i]["gridnick"] = grid->getGridNick(); gridInfo[i]["platform"] = HippoGridInfo::getPlatformString(grid->getPlatform()); gridInfo[i]["gridname"] = grid->getGridName(); gridInfo[i]["loginuri"] = grid->getLoginUri(); gridInfo[i]["loginpage"] = grid->getLoginPage(); gridInfo[i]["helperuri"] = grid->getHelperUri(); gridInfo[i]["website"] = grid->getWebSite(); gridInfo[i]["support"] = grid->getSupportUrl(); gridInfo[i]["register"] = grid->getRegisterUrl(); gridInfo[i]["password"] = grid->getPasswordUrl(); gridInfo[i]["firstname"] = grid->getFirstName(); gridInfo[i]["lastname"] = grid->getLastName(); gridInfo[i]["avatarpassword"] = grid->getAvatarPassword(); //gridInfo[i]["search"] = grid->getSearchUrl(); gridInfo[i]["render_compat"] = grid->isRenderCompat(); } // write client grid info file std::string fileName = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml"); llofstream file; file.open(fileName.c_str()); if (file.is_open()) { LLSDSerialize::toPrettyXML(gridInfo, file); file.close(); llinfos << "Saved grids to " << fileName << llendl; } else { llerrs << "Unable to open grid info file: " << fileName << llendl; } }
void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) { if (mergeIfNewer) { LLSD::array_const_iterator it, end = gridInfo.endArray(); for (it = gridInfo.beginArray(); it != end; ++it) { LLSD gridMap = *it; if (gridMap.has("default_grids_version")) { int version = gridMap["default_grids_version"]; if (version <= mDefaultGridsVersion) return; else break; } } if (it == end) { llwarns << "Grid data has no version number." << llendl; return; } } llinfos << "Loading grid data." << llendl; LLSD::array_const_iterator it, end = gridInfo.endArray(); for (it = gridInfo.beginArray(); it != end; ++it) { LLSD gridMap = *it; if (gridMap.has("default_grids_version")) { mDefaultGridsVersion = gridMap["default_grids_version"]; } else if (gridMap.has("gridnick") && gridMap.has("loginuri")) { std::string gridnick = gridMap["gridnick"]; HippoGridInfo *grid; GridIterator it = mGridInfo.find(gridnick); bool newGrid = (it == mGridInfo.end()); if (newGrid) { // create new grid info grid = new HippoGridInfo(gridnick); } else { // update existing grid info grid = it->second; } grid->setLoginUri(gridMap["loginuri"]); if (gridMap.has("platform")) grid->setPlatform(gridMap["platform"]); if (gridMap.has("gridname")) grid->setGridName(gridMap["gridname"]); if (gridMap.has("loginpage")) grid->setLoginPage(gridMap["loginpage"]); if (gridMap.has("helperuri")) grid->setHelperUri(gridMap["helperuri"]); if (gridMap.has("website")) grid->setWebSite(gridMap["website"]); if (gridMap.has("support")) grid->setSupportUrl(gridMap["support"]); if (gridMap.has("register")) grid->setRegisterUrl(gridMap["register"]); if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]); //if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); if (gridMap.has("firstname")) grid->setFirstName(gridMap["firstname"]); if (gridMap.has("lastname")) grid->setLastName(gridMap["lastname"]); if (gridMap.has("avatarpassword")) grid->setAvatarPassword(gridMap["avatarpassword"]); if (newGrid) addGrid(grid); } } }
void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) { LLSD::array_const_iterator it, end = gridInfo.endArray(); for (it = gridInfo.beginArray(); it != end; ++it) { LLSD gridMap = *it; if (gridMap.has("gridnick") && gridMap.has("loginuri")) { std::string gridnick = gridMap["gridnick"]; HippoGridInfo *grid; GridIterator it = mGridInfo.find(gridnick); bool newGrid = (it == mGridInfo.end()); if (gridMap.has("version")) { int version = gridMap["version"]; if (version == -1) { // delete grid if (!newGrid) mGridInfo.erase(it); continue; } else if (mergeIfNewer && !newGrid && (version <= it->second->getVersion())) { // don't update if version is not newer continue; } } if (newGrid) { // create new grid info grid = new HippoGridInfo(gridnick); } else { // update existing grid info grid = it->second; } grid->setLoginUri(gridMap["loginuri"]); if (gridMap.has("platform")) grid->setPlatform(gridMap["platform"]); if (gridMap.has("gridname")) grid->setGridName(gridMap["gridname"]); if (gridMap.has("lastlogin_fname")) grid->setLastFName(gridMap["lastlogin_fname"]); if (gridMap.has("lastlogin_lname")) grid->setLastLName(gridMap["lastlogin_lname"]); if (gridMap.has("loginpage")) grid->setLoginPage(gridMap["loginpage"]); if (gridMap.has("helperuri")) grid->setHelperUri(gridMap["helperuri"]); if (gridMap.has("website")) grid->setWebSite(gridMap["website"]); if (gridMap.has("support")) grid->setSupportUrl(gridMap["support"]); if (gridMap.has("register")) grid->setRegisterUrl(gridMap["register"]); if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]); //if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); if (gridMap.has("version")) grid->setVersion(gridMap["version"]); if (newGrid) addGrid(grid); } } }
void FloaterGridManager::retrieveGridInfo() { std::string loginuri = childGetValue("loginuri"); if ((loginuri == "") || (loginuri == "<required>")) { LLNotifications::instance().add("GridInfoNoLoginUri"); return; } HippoGridInfo* grid = 0; bool cleanupGrid = false; if (mState == NORMAL) { grid = gHippoGridManager->getGrid(mCurGrid); } else if ((mState == ADD_NEW) || (mState == ADD_COPY)) { grid = new HippoGridInfo(""); cleanupGrid = true; } else { llerrs << "Illegal state " << mState << '.' << llendl; return; } if (!grid) { llerrs << "Internal error retrieving grid info." << llendl; return; } grid->setLoginUri(loginuri); if (grid->retrieveGridInfo()) { if (grid->getGridNick() != "") childSetText("gridnick", grid->getGridNick()); if (grid->getGridName() != "") childSetText("gridname", grid->getGridName()); if (grid->getLoginUri() != "") childSetText("loginuri", grid->getLoginUri()); if (grid->getLoginPage() != "") childSetText("loginpage", grid->getLoginPage()); if (grid->getHelperUri() != "") childSetText("helperuri", grid->getHelperUri()); if (grid->getWebSite() != "") childSetText("website", grid->getWebSite()); if (grid->getSupportUrl() != "") childSetText("support", grid->getSupportUrl()); if (grid->getRegisterUrl() != "") childSetText("register", grid->getRegisterUrl()); if (grid->getPasswordUrl() != "") childSetText("password", grid->getPasswordUrl()); if (grid->getSearchUrl() != "") childSetText("search", grid->getSearchUrl()); } else { LLNotifications::instance().add("GridInfoError"); } if (cleanupGrid) delete grid; }
bool FloaterGridManager::createNewGrid() { // check nickname std::string gridnick = childGetValue("gridnick"); if (gridnick == "<required>") { gridnick = ""; } if (gridnick.empty()) { LLNotifications::instance().add("GridsNoNick"); return false; } if (gHippoGridManager->getGrid(gridnick)) { LLSD args; args["[NAME]"] = gridnick; LLNotifications::instance().add("GridExists", args); return false; } // check login URI std::string loginuri = childGetValue("loginuri"); if ((loginuri.empty()) || (loginuri == "<required>")) { LLSD args; args["[NAME]"] = gridnick; LLNotifications::instance().add("GridsNoLoginUri", args); return false; } // create new grid HippoGridInfo* grid = new HippoGridInfo(gridnick); grid->setGridName(childGetValue("gridname")); grid->setLoginUri(loginuri); grid->setLoginPage(childGetValue("loginpage")); grid->setHelperUri(childGetValue("helperuri")); grid->setWebSite(childGetValue("website")); grid->setSupportUrl(childGetValue("support")); grid->setRegisterUrl(childGetValue("register")); grid->setPasswordUrl(childGetValue("password")); grid->setSearchUrl(childGetValue("search")); grid->setRenderCompat(childGetValue("render_compat")); gHippoGridManager->addGrid(grid); grid->setFirstName(childGetValue("first_name")); grid->setLastName(childGetValue("last_name")); if(childGetValue("avatar_password").asString().empty()) grid->setAvatarPassword(std::string("")); else { std::string hashed_password; hashPassword(childGetValue("avatar_password"), hashed_password); grid->setAvatarPassword(hashed_password); } setCurGrid(gridnick); return true; }
void FloaterGridManager::applyChanges() { HippoGridInfo* gridInfo = gHippoGridManager->getGrid(mCurGrid); if (gridInfo) { if (gridInfo->getGridNick() == childGetValue("gridnick").asString()) { gridInfo->setGridName(childGetValue("gridname")); gridInfo->setLoginUri(childGetValue("loginuri")); gridInfo->setLoginPage(childGetValue("loginpage")); gridInfo->setHelperUri(childGetValue("helperuri")); gridInfo->setWebSite(childGetValue("website")); gridInfo->setSupportUrl(childGetValue("support")); gridInfo->setRegisterUrl(childGetValue("register")); gridInfo->setPasswordUrl(childGetValue("password")); gridInfo->setSearchUrl(childGetValue("search")); gridInfo->setRenderCompat(childGetValue("render_compat")); gridInfo->setFirstName(childGetValue("first_name")); gridInfo->setLastName(childGetValue("last_name")); if(childGetValue("avatar_password").asString().empty()) gridInfo->setAvatarPassword(std::string("")); else if(childGetValue("avatar_password").asString() != std::string(PASSWORD_FILLER)) { // store account authentication data std::string auth_password = childGetValue("avatar_password"); std::string hashed_password; hashPassword(auth_password, hashed_password); gridInfo->setAvatarPassword(hashed_password); } //this bug was a feature -Patrick Sapinski (Friday, August 21, 2009) //LLPanelLogin::setFields(gridInfo->getFirstName(), gridInfo->getLastName(), // gridInfo->getAvatarPassword(), true); } else { llwarns << "Grid nickname mismatch, ignoring changes." << llendl; } } }
void FloaterGridManager::refreshGrids() { LLScrollListCtrl *grids = FloaterGridManager::getInstance()->getChild<LLScrollListCtrl>("grid_selector"); std::string lastSelectedItem; LLSD element; if (grids->getFirstSelected()) { lastSelectedItem = grids->getFirstSelected()->getValue().asString(); } grids->deleteAllItems(); for (HippoGridManager::GridIterator it = gHippoGridManager->beginGrid(); it != gHippoGridManager->endGrid(); ++it) { std::string grid_nick = it->second->getGridNick(); // There's no reason why empty grids nicks should be in this list, ugh if (!grid_nick.empty() && grid_nick != gHippoGridManager->getCurrentGridNick()) { element["id"] = grid_nick; element["columns"][0]["column"] = "grid"; element["columns"][0]["type"] = "text"; element["columns"][0]["value"] = grid_nick; grids->addElement(element, ADD_BOTTOM); } } // Setting the default needs to be rethought. // Right now, we just use the last-selected grid, // but leaving this as the current behavior for now if (!gHippoGridManager->getCurrentGridNick().empty()) { element["id"] = gHippoGridManager->getCurrentGridNick(); element["columns"][0]["column"] = "grid"; element["columns"][0]["type"] = "text"; element["columns"][0]["font-style"] = "BOLD"; element["columns"][0]["value"] = gHippoGridManager->getCurrentGridNick(); grids->addElement(element, ADD_TOP); } // Reselect the item if we had one selected if (lastSelectedItem.empty()) { grids->selectItemByLabel(gHippoGridManager->getCurrentGridNick()); } else { grids->selectItemByLabel(lastSelectedItem); } // TODO: get rid of all this state junk if ((FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY)) { grids->addElement("<new>", ADD_BOTTOM); } //if (selectIndex >= 0) //{ // grids->setCurrentByIndex(selectIndex); //} //else //{ // grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label //} // FloaterGridManager::getInstance()->childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " "); FloaterGridManager::getInstance()->childSetEnabled("btn_delete", grids->getItemCount() > 0); FloaterGridManager::getInstance()->childSetEnabled("btn_copy", (FloaterGridManager::getInstance()->getState() == NORMAL) && (grids->getItemCount() > 0)); // FloaterGridManager::getInstance()->childSetEnabled("set_default", (FloaterGridManager::getInstance()->getState() == NORMAL) && (grids->getItemCount() > 0)); FloaterGridManager::getInstance()->childSetEnabled("gridnick", (FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY)); if (FloaterGridManager::getInstance()->getState() == NORMAL) { HippoGridInfo *gridInfo = gHippoGridManager->getGrid(FloaterGridManager::getInstance()->getCurGrid()); if (gridInfo) { FloaterGridManager::getInstance()->childSetText("gridnick", gridInfo->getGridNick()); //FloaterGridManager::getInstance()->childSetText("grid_name", gridInfo->getGridName()); FloaterGridManager::getInstance()->childSetText("loginuri", gridInfo->getLoginUri()); FloaterGridManager::getInstance()->childSetText("loginpage", gridInfo->getLoginPage()); FloaterGridManager::getInstance()->childSetText("helperuri", gridInfo->getHelperUri()); FloaterGridManager::getInstance()->childSetText("website", gridInfo->getWebSite()); FloaterGridManager::getInstance()->childSetText("support", gridInfo->getSupportUrl()); FloaterGridManager::getInstance()->childSetText("register", gridInfo->getRegisterUrl()); FloaterGridManager::getInstance()->childSetText("password", gridInfo->getPasswordUrl()); FloaterGridManager::getInstance()->childSetText("first_name", gridInfo->getFirstName()); FloaterGridManager::getInstance()->childSetText("last_name", gridInfo->getLastName()); if(gridInfo->getAvatarPassword().length() == 32) FloaterGridManager::getInstance()->childSetText("avatar_password", std::string(PASSWORD_FILLER)); else if(gridInfo->getPasswordUrl().empty()) FloaterGridManager::getInstance()->childSetText("avatar_password", std::string("")); if (gridInfo->getPlatform() == HippoGridInfo::PLATFORM_SECONDLIFE) { FloaterGridManager::getInstance()->childSetEnabled("search", false); FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null); //childSetEnabled("render_compat", false); //childSetValue("render_compat", false); } else { FloaterGridManager::getInstance()->childSetEnabled("search", true); FloaterGridManager::getInstance()->childSetText("search", gridInfo->getSearchUrl()); //childSetEnabled("render_compat", true); //childSetValue("render_compat", gridInfo->isRenderCompat()); } } else { FloaterGridManager::getInstance()->childSetText("gridnick", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("gridname", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("loginuri", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("loginpage", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("helperuri", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("website", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("support", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("register", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("password", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("first_name", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("last_name", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("avatar_password", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null); } } else if (FloaterGridManager::getInstance()->getState() == ADD_NEW) { llinfos << "mState == ADD_NEW" << llendl; std::string required = "<required>"; FloaterGridManager::getInstance()->childSetText("gridnick", required); FloaterGridManager::getInstance()->childSetText("gridname", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("loginuri", required); FloaterGridManager::getInstance()->childSetText("loginpage", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("helperuri", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("website", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("support", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("register", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("password", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("first_name", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("last_name", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("avatar_password", LLStringUtil::null); // childSetEnabled("search", true); FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null); } else if (FloaterGridManager::getInstance()->getState() == ADD_COPY) { llinfos << "mState == ADD_COPY" << llendl; FloaterGridManager::getInstance()->childSetText("gridnick", LLStringExplicit("<required>")); } else { llwarns << "Illegal state " << FloaterGridManager::getInstance()->getState() << llendl; } return; }
void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) { if (mergeIfNewer) { LLSD::array_const_iterator it, end = gridInfo.endArray(); for (it = gridInfo.beginArray(); it != end; ++it) { LLSD gridMap = *it; if (gridMap.has("default_grids_version")) { int version = gridMap["default_grids_version"]; if (version <= mDefaultGridsVersion) return; else break; } } if (it == end) { llwarns << "Grid data has no version number." << llendl; return; } } llinfos << "Loading grid data." << llendl; LLSD::array_const_iterator it, end = gridInfo.endArray(); for (it = gridInfo.beginArray(); it != end; ++it) { LLSD gridMap = *it; if (gridMap.has("default_grids_version")) { mDefaultGridsVersion = gridMap["default_grids_version"]; } else if ((gridMap.has("gridnick") || gridMap.has("gridname")) && gridMap.has("loginuri")) { std::string gridnick = gridMap["gridnick"]; std::string gridname = gridMap["gridname"]; HippoGridInfo* grid; GridIterator it = mGridInfo.end(); for (it = mGridInfo.begin(); it != mGridInfo.end(); ++it) { if(!gridnick.empty() && (it->second->getGridNick() == gridnick)) { break; } if(gridnick.empty() && !gridname.empty() && (it->first == gridname)) { break; } } bool newGrid = (it == mGridInfo.end()); if (newGrid || !it->second) { if(gridname.empty()) { gridname = gridnick; } // create new grid info grid = new HippoGridInfo(gridname); } else { // update existing grid info grid = it->second; } grid->setLoginUri(gridMap["loginuri"]); if (gridMap.has("platform")) grid->setPlatform(gridMap["platform"]); if (gridMap.has("gridname")) grid->setGridName(gridMap["gridname"]); if (gridMap.has("gridnick")) grid->setGridNick(gridMap["gridnick"]); if (gridMap.has("loginpage")) grid->setLoginPage(gridMap["loginpage"]); if (gridMap.has("helperuri")) grid->setHelperUri(gridMap["helperuri"]); if (gridMap.has("website")) grid->setWebSite(gridMap["website"]); if (gridMap.has("support")) grid->setSupportUrl(gridMap["support"]); if (gridMap.has("register")) grid->setRegisterUrl(gridMap["register"]); if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]); if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); if (gridMap.has("inventory_links")) grid->setSupportsInvLinks(gridMap["inventory_links"]); if (gridMap.has("auto_update")) grid->mAutoUpdate = gridMap["auto_update"]; if (gridMap.has("locked")) grid->mLocked = gridMap["locked"]; if (newGrid) addGrid(grid); } } }
std::string HippoGridManager::getDefaultGridNick() const { HippoGridInfo* grid = getGrid(mDefaultGrid); return grid ? grid->getGridNick() : HippoGridInfo::FALLBACK_GRIDINFO.getGridNick(); }