void LLMuteList::parseSimulatorFeatures() { LLViewerRegion* regionp = gAgent.getRegion(); if (!regionp) return; LLSD info; regionp->getSimulatorFeatures(info); mGodLastNames.clear(); mGodFullNames.clear(); if (info.has("god_names")) { if (info["god_names"].has("last_names")) { LLSD godNames = info["god_names"]["last_names"]; for (LLSD::array_iterator godNames_it = godNames.beginArray(); godNames_it != godNames.endArray(); ++godNames_it) mGodLastNames.insert((*godNames_it).asString()); } if (info["god_names"].has("full_names")) { LLSD godNames = info["god_names"]["full_names"]; for (LLSD::array_iterator godNames_it = godNames.beginArray(); godNames_it != godNames.endArray(); ++godNames_it) mGodFullNames.insert((*godNames_it).asString()); } } else // Just use Linden { mGodLastNames.insert("Linden"); } }
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 LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjectPtr pObjectPtr, const LLSD &pScrollListItemData) { LLScrollListCell::Params cellParams; //cellParams.font = LLFontGL::getFontSansSerif(); LLScrollListItem::Params rowParams; rowParams.value = pObjectPtr->getUUID().asString(); llassert(pScrollListItemData.isArray()); for (LLSD::array_const_iterator cellIter = pScrollListItemData.beginArray(); cellIter != pScrollListItemData.endArray(); ++cellIter) { const LLSD &cellElement = *cellIter; llassert(cellElement.has("column")); llassert(cellElement.get("column").isString()); cellParams.column = cellElement.get("column").asString(); llassert(cellElement.has("value")); llassert(cellElement.get("value").isString()); cellParams.value = cellElement.get("value").asString(); rowParams.columns.add(cellParams); } LLScrollListItem *scrollListItem = mObjectsScrollList->addRow(rowParams); if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName()) { mMissingNameObjectsScrollListItems.insert(std::make_pair(pObjectPtr->getUUID().asString(), scrollListItem)); pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1)); } }
bool LLNotificationsListener::Forwarder::matchType(const LLSD& filter, const std::string& type) const { // Decide whether this notification matches filter: // undefined: forward all notifications if (filter.isUndefined()) { return true; } // array of string: forward any notification matching any named type if (filter.isArray()) { for (LLSD::array_const_iterator ti(filter.beginArray()), tend(filter.endArray()); ti != tend; ++ti) { if (ti->asString() == type) { return true; } } // Didn't match any entry in the array return false; } // string: forward only the specific named type return (filter.asString() == type); }
void LLViewerTextureList::doPrefetchImages() { if (LLAppViewer::instance()->getPurgeCache()) { // cache was purged, no point return; } // Pre-fetch textures from last logout LLSD imagelist; std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); llifstream file; file.open(filename); if (file.is_open()) { LLSDSerialize::fromXML(imagelist, file); } for (LLSD::array_iterator iter = imagelist.beginArray(); iter != imagelist.endArray(); ++iter) { LLSD imagesd = *iter; LLUUID uuid = imagesd["uuid"]; S32 pixel_area = imagesd["area"]; S32 texture_type = imagesd["type"]; if(LLViewerTexture::FETCHED_TEXTURE == texture_type || LLViewerTexture::LOD_TEXTURE == texture_type) { LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, MIPMAP_TRUE, LLViewerTexture::BOOST_NONE, texture_type); if (image) { image->addTextureStats((F32)pixel_area); } } } }
void LLViewerImageList::doPrefetchImages() { #if 1 if (LLAppViewer::instance()->getPurgeCache()) { // cache was purged, no point return; } // Pre-fetch textures from last logout LLSD imagelist; std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); llifstream file; file.open(filename); if (file.is_open()) { LLSDSerialize::fromXML(imagelist, file); } for (LLSD::array_iterator iter = imagelist.beginArray(); iter != imagelist.endArray(); ++iter) { LLSD imagesd = *iter; LLUUID uuid = imagesd["uuid"]; S32 pixel_area = imagesd["area"]; LLViewerImage* image = getImage(uuid, MIPMAP_TRUE, FALSE); if (image) { image->addTextureStats((F32)pixel_area); } } #endif }
// This function is called when a new message is received from the plugin. // We get here when calling mPluginManager->update() in the first line of // AIFilePicker::multiplex_impl. // // Note that we can't call finish() or abort() directly in this function, // as that deletes mPluginManager and we're using the plugin manager // right now (to receive this message)! void AIFilePicker::receivePluginMessage(const LLPluginMessage &message) { std::string message_class = message.getClass(); if (message_class == LLPLUGIN_MESSAGE_CLASS_BASIC) { std::string message_name = message.getName(); if (message_name == "canceled") { LL_DEBUGS("Plugin") << "received message \"canceled\"" << LL_ENDL; set_state(AIFilePicker_canceled); } else if (message_name == "done") { LL_DEBUGS("Plugin") << "received message \"done\"" << LL_ENDL; LLSD filenames = message.getValueLLSD("filenames"); mFilenames.clear(); for(LLSD::array_iterator filename = filenames.beginArray(); filename != filenames.endArray(); ++filename) { mFilenames.push_back(*filename); } set_state(AIFilePicker_done); } else { LL_WARNS("Plugin") << "Unknown " << message_class << " class message: " << message_name << LL_ENDL; } } }
void configure(const LLSD& config) { Globals& g = Globals::get(); Settings& s = Settings::get(); g.invalidateCallSites(); s.functionLevelMap.clear(); s.classLevelMap.clear(); s.fileLevelMap.clear(); setPrintLocation(config["print-location"]); setDefaultLevel(decodeLevel(config["default-level"])); LLSD sets = config["settings"]; LLSD::array_const_iterator a, end; for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a) { const LLSD& entry = *a; ELevel level = decodeLevel(entry["level"]); setLevels(s.functionLevelMap, entry["functions"], level); setLevels(s.classLevelMap, entry["classes"], level); setLevels(s.fileLevelMap, entry["files"], level); } }
// static bool LLGiveInventory::handleCopyProtectedItem(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); LLSD itmes = notification["payload"]["items"]; LLInventoryItem* item = NULL; switch(option) { case 0: // "Yes" for (LLSD::array_iterator it = itmes.beginArray(); it != itmes.endArray(); it++) { item = gInventory.getItem((*it).asUUID()); if (item) { LLGiveInventory::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(), item); // delete it for now - it will be deleted on the server // quickly enough. gInventory.deleteObject(item->getUUID()); gInventory.notifyObservers(); } else { LLNotificationsUtil::add("CannotGiveItem"); } } break; default: // no, cancel, whatever, who cares, not yes. LLNotificationsUtil::add("TransactionCancelled"); break; } return false; }
bool LLFacebookFriendsPanel::updateSuggestedFriendList() { const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); uuid_vec_t& second_life_friends = mSecondLifeFriends->getIDs(); second_life_friends.clear(); uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs(); suggested_friends.clear(); //Add suggested friends LLSD friends = LLFacebookConnect::instance().getContent(); for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i) { LLUUID agent_id = (*i).asUUID(); if (agent_id.notNull()) { bool second_life_buddy = av_tracker.isBuddy(agent_id); if (second_life_buddy) { second_life_friends.push_back(agent_id); } else { //FB+SL but not SL friend suggested_friends.push_back(agent_id); } } } //Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display) mSecondLifeFriends->setDirty(true, !mSecondLifeFriends->filterHasMatches()); mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches()); showFriendsAccordionsIfNeeded(); return false; }
void configure(const LLSD& config) { AIAccess<Settings> settings_w(Settings::get()); AIAccess<Globals>(Globals::get())->invalidateCallSites(); settings_w->functionLevelMap.clear(); settings_w->classLevelMap.clear(); settings_w->fileLevelMap.clear(); settings_w->tagLevelMap.clear(); settings_w->uniqueLogMessages.clear(); setPrintLocation(settings_w, config["print-location"]); setDefaultLevel(settings_w, decodeLevel(config["default-level"])); LLSD sets = config["settings"]; LLSD::array_const_iterator a, end; for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a) { const LLSD& entry = *a; ELevel level = decodeLevel(entry["level"]); setLevels(settings_w->functionLevelMap, entry["functions"], level); setLevels(settings_w->classLevelMap, entry["classes"], level); setLevels(settings_w->fileLevelMap, entry["files"], level); setLevels(settings_w->tagLevelMap, entry["tags"], level); } }
/*virtual*/ void httpCompleted() { LLSD experiences = getContent()["experience_keys"]; LLSD::array_const_iterator it = experiences.beginArray(); for( /**/ ; it != experiences.endArray(); ++it) { const LLSD& row = *it; LLUUID public_key = row[EXPERIENCE_ID].asUUID(); LL_DEBUGS("ExperienceCache") << "Received result for " << public_key << " display '" << row[LLExperienceCache::NAME].asString() << "'" << LL_ENDL ; processExperience(public_key, row); } LLSD error_ids = getContent()["error_ids"]; LLSD::array_const_iterator errIt = error_ids.beginArray(); for( /**/ ; errIt != error_ids.endArray() ; ++errIt ) { LLUUID id = errIt->asUUID(); LLSD exp; exp[EXPIRES]=DEFAULT_EXPIRATION; exp[EXPERIENCE_ID] = id; exp[PROPERTIES]=PROPERTY_INVALID; exp[MISSING]=true; exp[QUOTA] = DEFAULT_QUOTA; processExperience(id, exp); LL_WARNS("ExperienceCache") << "LLExperienceResponder::result() error result for " << id << LL_ENDL ; } LL_DEBUGS("ExperienceCache") << sCache.size() << " cached experiences" << LL_ENDL; }
/*virtual*/ void result(const LLSD& content) { // Pull expiration out of headers if available F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mHeaders); F64 now = LLFrameTimer::getTotalSeconds(); LLSD agents = content["agents"]; LLSD::array_const_iterator it = agents.beginArray(); for ( ; it != agents.endArray(); ++it) { const LLSD& row = *it; LLUUID agent_id = row["id"].asUUID(); LLAvatarName av_name; av_name.fromLLSD(row); // Use expiration time from header av_name.mExpires = expires; // Some avatars don't have explicit display names set if (av_name.mDisplayName.empty()) { av_name.mDisplayName = av_name.mUsername; } LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << " " << "user '" << av_name.mUsername << "' " << "display '" << av_name.mDisplayName << "' " << "expires in " << expires - now << " seconds" << LL_ENDL; // cache it and fire signals LLAvatarNameCache::processName(agent_id, av_name, true); } // Same logic as error response case LLSD unresolved_agents = content["bad_ids"]; S32 num_unresolved = unresolved_agents.size(); if (num_unresolved > 0) { LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; " << "expires in " << expires - now << " seconds" << LL_ENDL; it = unresolved_agents.beginArray(); for ( ; it != unresolved_agents.endArray(); ++it) { const LLUUID& agent_id = *it; LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << "failed id " << agent_id << LL_ENDL; LLAvatarNameCache::handleAgentError(agent_id); } } LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result " << LLAvatarNameCache::sCache.size() << " cached names" << LL_ENDL; }
/*virtual*/ void result(const LLSD& content) { // Pull expiration out of headers if available F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mHeaders); LLSD agents = content["agents"]; LLSD::array_const_iterator it = agents.beginArray(); for ( ; it != agents.endArray(); ++it) { const LLSD& row = *it; LLUUID agent_id = row["id"].asUUID(); LLAvatarName av_name; av_name.fromLLSD(row); // Use expiration time from header av_name.mExpires = expires; // Some avatars don't have explicit display names set if (av_name.mDisplayName.empty()) { av_name.mDisplayName = av_name.mUsername; } // cache it and fire signals LLAvatarNameCache::processName(agent_id, av_name, true); } // Same logic as error response case LLSD unresolved_agents = content["bad_ids"]; if (unresolved_agents.size() > 0) { const std::string DUMMY_NAME("\?\?\?"); LLAvatarName av_name; av_name.mUsername = DUMMY_NAME; av_name.mDisplayName = DUMMY_NAME; av_name.mIsDisplayNameDefault = false; av_name.mIsDummy = true; av_name.mExpires = expires; it = unresolved_agents.beginArray(); for ( ; it != unresolved_agents.endArray(); ++it) { const LLUUID& agent_id = *it; // cache it and fire signals // Wolfspirit: Do not use ??? as username. Try to get a username out of the old legacy name std::string oldname; gCacheName->getFullName(agent_id, oldname); LLStringUtil::toLower(oldname); LLStringUtil::replaceString(oldname," ","."); LLStringUtil::replaceString(oldname,".resident",""); av_name.mUsername = oldname; LLAvatarNameCache::processName(agent_id, av_name, true); } } }
U32 LLMediaEntry::setWhiteList( const LLSD &whitelist ) { // If whitelist is undef, the whitelist is cleared if (whitelist.isUndefined()) { mWhiteList.clear(); return LSL_STATUS_OK; } // However, if the whitelist is an empty array, erase it. if (whitelist.isArray()) { // *NOTE: This code is VERY similar to the setWhitelist above. // IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER! U32 size = 0; U32 count = 0; // First check to make sure the size and count constraints are not violated LLSD::array_const_iterator iter = whitelist.beginArray(); LLSD::array_const_iterator end = whitelist.endArray(); for ( ; iter < end; ++iter) { const std::string &entry = (*iter).asString(); size += entry.length() + 1; // Include one for \0 count ++; if (size > MAX_WHITELIST_SIZE || count > MAX_WHITELIST_COUNT) { return LSL_STATUS_BOUNDS_ERROR; } } // Next clear the vector mWhiteList.clear(); // Then re-iterate and copy entries iter = whitelist.beginArray(); for ( ; iter < end; ++iter) { const std::string &entry = (*iter).asString(); mWhiteList.push_back(entry); } return LSL_STATUS_OK; } else { return LSL_STATUS_MALFORMED_PARAMS; } }
LLSavedLogins::LLSavedLogins(const LLSD& history_data) { if (!history_data.isArray()) throw std::invalid_argument("Invalid history data."); for (LLSD::array_const_iterator i = history_data.beginArray(); i != history_data.endArray(); ++i) { // Put the last used grids first. if (!i->isUndefined()) mEntries.push_front(LLSavedLoginEntry(*i)); } }
void LLEventNotifier::load(const LLSD& event_options) { for(LLSD::array_const_iterator resp_it = event_options.beginArray(), end = event_options.endArray(); resp_it != end; ++resp_it) { LLSD response = *resp_it; add(response["event_id"].asInteger(), response["event_date_ut"], response["event_date"].asString(), response["event_name"].asString()); } }
void LLExperienceCache::mapKeys( const LLSD& legacyKeys ) { LLSD::array_const_iterator exp = legacyKeys.beginArray(); for(/**/ ; exp != legacyKeys.endArray() ; ++exp) { if(exp->has(LLExperienceCache::EXPERIENCE_ID) && exp->has(LLExperienceCache::PRIVATE_KEY)) { privateToPublicKeyMap[(*exp)[LLExperienceCache::PRIVATE_KEY].asUUID()]=(*exp)[LLExperienceCache::EXPERIENCE_ID].asUUID(); } } }
void LLNotificationForm::append(const LLSD& sub_form) { if (sub_form.isArray()) { for (LLSD::array_const_iterator it = sub_form.beginArray(); it != sub_form.endArray(); ++it) { mFormData.append(*it); } } }
// validate that the LLSD array in llsd_set contains the llsd_value bool _LLSDArrayIncludesValue(const LLSD& llsd_set, LLSD llsd_value) { for(LLSD::array_const_iterator set_value = llsd_set.beginArray(); set_value != llsd_set.endArray(); set_value++) { if(valueCompareLLSD((*set_value), llsd_value)) { return TRUE; } } return FALSE; }
static void append_node_paths(LLSD& result, const std::string& name, const LLHTTPNode* node) { result.append(name); LLSD paths = node->allNodePaths(); LLSD::array_const_iterator i = paths.beginArray(); LLSD::array_const_iterator end = paths.endArray(); for (; i != end; ++i) { result.append(name + "/" + (*i).asString()); } }
F32 lggBeamMaps::setUpAndGetDuration() { static LLCachedControl<std::string> settingNameCached(gSavedSettings, "FSBeamShape"); std::string settingName(settingNameCached); if (settingName != mLastFileName) { mLastFileName = settingName; if (!settingName.empty()) { std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "beams", "")); std::string path_name2(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS , "beams", "")); std::string filename = path_name + settingName + ".xml"; if (!gDirUtilp->fileExists(filename)) { filename = path_name2 + settingName + ".xml"; } LLSD mydata = getPic(filename); mScale = (F32)mydata["scale"].asReal() / 10.0f; LLSD myPicture = mydata["data"]; mDots.clear(); for (LLSD::array_iterator it = myPicture.beginArray(); it != myPicture.endArray(); ++it) { LLSD beamData = *it; lggBeamData dot; dot.p = LLVector3d(beamData["offset"]); static LLCachedControl<F32> FSBeamShapeScale(gSavedSettings, "FSBeamShapeScale"); dot.p *= (FSBeamShapeScale * 2.0f); LLColor4 color = LLColor4(beamData["color"]); dot.c = LLColor4U(color); mDots.push_back(dot); } static LLCachedControl<F32> FSMaxBeamsPerSecond(gSavedSettings, "FSMaxBeamsPerSecond"); F32 maxBPerQS = FSMaxBeamsPerSecond / 4.0f; mDuration = llceil((F32)(myPicture.size()) / maxBPerQS) * 0.25f; LL_INFOS("LGG_Beams") << "reading it all now size is " << myPicture.size() << " and duration is " << mDuration << LL_ENDL; } else { mDots.clear(); mScale = 0.0f; //used as a flag too mDuration = 0.25f; } } return mDuration; }
void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD& content) { // Check for out-of-date query if (query_id != mQueryID) return; LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>("SearchResults"); LLSD agents = content["agents"]; if (agents.size() == 0) { LLStringUtil::format_map_t map; map["[TEXT]"] = childGetText("Edit"); LLSD item; item["id"] = LLUUID::null; item["columns"][0]["column"] = "name"; item["columns"][0]["value"] = getString("not_found", map); search_results->addElement(item); search_results->setEnabled(false); getChildView("ok_btn")->setEnabled(false); return; } // clear "Searching" label on first results search_results->deleteAllItems(); LLSD item; LLSD::array_const_iterator it = agents.beginArray(); for ( ; it != agents.endArray(); ++it) { const LLSD& row = *it; item["id"] = row["id"]; LLSD& columns = item["columns"]; columns[0]["column"] = "name"; columns[0]["value"] = row["display_name"]; columns[1]["column"] = "username"; columns[1]["value"] = row["username"]; search_results->addElement(item); // add the avatar name to our list LLAvatarName avatar_name; avatar_name.fromLLSD(row); sAvatarNameMap[row["id"].asUUID()] = avatar_name; } getChildView("ok_btn")->setEnabled(true); search_results->setEnabled(true); search_results->selectFirstItem(); onList(); search_results->setFocus(TRUE); }
// static void LLClassifiedInfo::loadCategories(const LLSD& options) { for(LLSD::array_const_iterator resp_it = options.beginArray(), end = options.endArray(); resp_it != end; ++resp_it) { LLSD name = (*resp_it)["category_name"]; if(name.isDefined()) { LLSD id = (*resp_it)["category_id"]; if(id.isDefined()) { LLClassifiedInfo::sCategories[id.asInteger()] = name.asString(); } } } }
void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const { // return the login uri set on the command line. LLControlVariable* c = gSavedSettings.getControl("CmdLineLoginURI"); if(c && !LLStartUp::shouldAutoLogin()) { LLSD v = c->getValue(); if(v.isArray()) { for(LLSD::array_const_iterator itr = v.beginArray(); itr != v.endArray(); ++itr) { std::string uri = itr->asString(); if(!uri.empty()) { uris.push_back(uri); } } } else { std::string uri = v.asString(); if(!uri.empty()) { uris.push_back(uri); } } } // If there was no command line uri... if(uris.empty()) { uris.push_back(gHippoGridManager->getConnectedGrid()->getLoginUri()); /* // If its a known grid choice, get the uri from the table, // else try the grid name. if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER) { uris.push_back(gGridInfo[mGridChoice].mLoginURI); } else { uris.push_back(mGridName); } */ } }
// static LLURI LLURI::buildHTTP(const std::string& prefix, const LLSD& path) { LLURI result; // TODO: deal with '/' '?' '#' in host_port if (prefix.find("://") != prefix.npos) { // it is a prefix result = LLURI(prefix); } else { // it is just a host and optional port result.mScheme = "http"; result.mEscapedAuthority = escapeHostAndPort(prefix); } if (path.isArray()) { // break out and escape each path component for (LLSD::array_const_iterator it = path.beginArray(); it != path.endArray(); ++it) { lldebugs << "PATH: inserting " << it->asString() << llendl; result.mEscapedPath += "/" + escapePathComponent(it->asString()); } } else if(path.isString()) { result.mEscapedPath += "/" + escapePathComponent(path.asString()); } else if(path.isUndefined()) { // do nothing } else { llwarns << "Valid path arguments to buildHTTP are array, string, or undef, you passed type" << path.type() << llendl; } result.mEscapedOpaque = "//" + result.mEscapedAuthority + result.mEscapedPath; return result; }
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 LLEventNotifier::load(const LLSD& event_options) { for(LLSD::array_const_iterator resp_it = event_options.beginArray(), end = event_options.endArray(); resp_it != end; ++resp_it) { LLSD response = *resp_it; LLEventNotification *new_enp = new LLEventNotification(); if(!new_enp->load(response)) { delete new_enp; continue; } mEventNotifications[new_enp->getEventID()] = new_enp; } }
void LLPanelGroupExperiences::setExperienceList(const LLSD& experiences) { if (hasString("no_experiences")) { mExperiencesList->setNoItemsCommentText(getString("no_experiences")); } mExperiencesList->clear(); LLSD::array_const_iterator it = experiences.beginArray(); for ( /**/ ; it != experiences.endArray(); ++it) { LLUUID public_key = it->asUUID(); LLExperienceItem* item = new LLExperienceItem(); item->init(public_key); mExperiencesList->addItem(item, public_key); } }
/*virtual*/ void post( LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& content) const { if( 4 != content.size() ) return;//accept 3 leave out water? LLSD::array_const_iterator it = content.beginArray(); LLSD message = *it++; LLSD day_cycle = *it++; LLSD skys = *it++; LLSD water = *it; LLUUID region_id = message["regionID"]; LLViewerRegion* region = gAgent.getRegion(); if( region_id != region->getRegionID() ) { llwarns << "wrong region" << llendl; return; } llwarns << "set water" << llendl; LLWaterParamManager* water_mgr = LLWaterParamManager::instance(); std::string water_name = "Region Water ("; water_name.append(region->getName()); water_name.append(")"); water_mgr->loadPresetFromRegion(water_name, water, true); LLWLParamManager* wl_mgr = LLWLParamManager::instance(); LLSD::map_const_iterator sky_it = skys.beginMap(); LLSD::map_const_iterator sky_end = skys.endMap(); for(;sky_it != sky_end; sky_it++) { wl_mgr->loadPresetFromRegion(sky_it->first, sky_it->second, true); } std::string dayCycle_name = "Region Settings ("; wl_mgr->mDay.loadRegionDayCycle(day_cycle); dayCycle_name.append(region->getName()); dayCycle_name.append(")"); wl_mgr->mDay.mName = dayCycle_name; if( 5 == content.size() )//Server sent the time too, so use it wl_mgr->resetAnimator(*++it, true); else wl_mgr->resetAnimator(0.5, true);//Set as midday then wl_mgr->mAnimator.mUseLindenTime = true; }