std::string LLURI::mapToQueryString(const LLSD& queryMap) { std::string query_string; if (queryMap.isMap()) { bool first_element = true; LLSD::map_const_iterator iter = queryMap.beginMap(); LLSD::map_const_iterator end = queryMap.endMap(); std::ostringstream ostr; for (; iter != end; ++iter) { if(first_element) { ostr << "?"; first_element = false; } else { ostr << "&"; } ostr << ::escapeQueryVariable(iter->first); if(iter->second.isDefined()) { ostr << "=" << ::escapeQueryValue(iter->second.asString()); } } query_string = ostr.str(); } return query_string; }
// Find a certificate in the list. // It will find a cert that has minimally the params listed, with the values being the same LLBasicCertificateVector::iterator LLBasicCertificateVector::find(const LLSD& params) { BOOL found = FALSE; // loop through the entire vector comparing the values in the certs // against those passed in via the params. // params should be a map. Only the items specified in the map will be // checked, but they must match exactly, even if they're maps or arrays. for(iterator cert = begin(); cert != end(); cert++) { found= TRUE; LLSD cert_info; (*cert)->getLLSD(cert_info); for (LLSD::map_const_iterator param = params.beginMap(); param != params.endMap(); param++) { if (!cert_info.has((std::string)param->first) || (!valueCompareLLSD(cert_info[(std::string)param->first], param->second))) { found = FALSE; break; } } if (found) { return (cert); } } return end(); }
void LLAvatarNameCache::importFile(std::istream& istr) { LLSD data; S32 parse_count = LLSDSerialize::fromXMLDocument(data, istr); if (parse_count < 1) return; // by convention LLSD storage is a map // we only store one entry in the map LLSD agents = data["agents"]; LLUUID agent_id; LLAvatarName av_name; LLSD::map_const_iterator it = agents.beginMap(); for ( ; it != agents.endMap(); ++it) { agent_id.set(it->first); av_name.fromLLSD( it->second ); sCache[agent_id] = av_name; } LL_INFOS("AvNameCache") << "loaded " << sCache.size() << LL_ENDL; // Some entries may have expired since the cache was stored, // but they will be flushed in the first call to eraseUnrefreshed // from LLAvatarNameResponder::idle }
// static bool AIFilePicker::loadFile(std::string const& filename) { LLSD data; std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename); llifstream file(filepath); if (file.is_open()) { LL_INFOS() << "Loading filepicker context file at \"" << filepath << "\"." << LL_ENDL; LLSDSerialize::fromXML(data, file); } if (!data.isMap()) { LL_INFOS() << "File missing, ill-formed, or simply undefined; not changing the file (" << filepath << ")." << LL_ENDL; return false; } AIAccess<context_map_type> wContextMap(sContextMap); for (LLSD::map_const_iterator iter = data.beginMap(); iter != data.endMap(); ++iter) { wContextMap->insert(context_map_type::value_type(iter->first, iter->second.asString())); } return true; }
//private bool LLFloaterMediaSettings::haveValuesChanged() const { bool values_changed = false; // *NOTE: The code below is very inefficient. Better to do this // only when data change. // Every frame, check to see what the values are. If they are not // the same as the initial media data, enable the OK/Apply buttons LLSD settings; sInstance->mPanelMediaSettingsGeneral->getValues( settings ); sInstance->mPanelMediaSettingsSecurity->getValues( settings ); sInstance->mPanelMediaSettingsPermissions->getValues( settings ); LLSD::map_const_iterator iter = settings.beginMap(); LLSD::map_const_iterator end = settings.endMap(); for ( ; iter != end; ++iter ) { const std::string ¤t_key = iter->first; const LLSD ¤t_value = iter->second; if ( ! llsd_equals(current_value, mInitialValues[current_key])) { values_changed = true; break; } } return values_changed; }
void PhoenixViewerLink::msblacklist(U32 status,std::string body) { if(status != 200) { LL_WARNS("Blacklist") << "Something went wrong with the blacklist download status code " << status << LL_ENDL; } std::istringstream istr(body); if (body.size() > 0) { LLSD data; if(LLSDSerialize::fromXML(data,istr) >= 1) { LL_INFOS("Blacklist") << body.size() << " bytes received, updating local blacklist" << LL_ENDL; for(LLSD::map_iterator itr = data.beginMap(); itr != data.endMap(); ++itr) { if(itr->second.has("name")) LLFloaterBlacklist::addEntry(LLUUID(itr->first),itr->second); } } else { LL_INFOS("Blacklist") << "Failed to parse blacklist.xml" << LL_ENDL; } } else { LL_INFOS("Blacklist") << "Empty blacklist.xml" << LL_ENDL; } }
LLImportWearable::LLImportWearable(LLSD sd) { mOrginalLLSD = sd; mName = sd["name"].asString(); mType = sd["wearabletype"].asInteger(); LLSD params = sd["params"]; LLSD textures = sd["textures"]; mData = "LLWearable version 22\n" + mName + "\n\n" + "\tpermissions 0\n" + "\t{\n" + "\t\tbase_mask\t7fffffff\n" + "\t\towner_mask\t7fffffff\n" + "\t\tgroup_mask\t00000000\n" + "\t\teveryone_mask\t00000000\n" + "\t\tnext_owner_mask\t00082000\n" + "\t\tcreator_id\t00000000-0000-0000-0000-000000000000\n" + "\t\towner_id\t" + gAgent.getID().asString() + "\n" + "\t\tlast_owner_id\t" + gAgent.getID().asString() + "\n" + "\t\tgroup_id\t00000000-0000-0000-0000-000000000000\n" + "\t}\n" + "\tsale_info\t0\n" + "\t{\n" + "\t\tsale_type\tnot\n" + "\t\tsale_price\t10\n" + "\t}\n" + "type " + llformat("%d", mType) + "\n"; mData += llformat("parameters %d\n", params.size()); LLSD::map_iterator map_iter = params.beginMap(); LLSD::map_iterator map_end = params.endMap(); for( ; map_iter != map_end; ++map_iter) { mData += (*map_iter).first + " " + terse_F32_string((*map_iter).second.asReal()) + "\n"; } mData += llformat("textures %d\n", textures.size()); map_iter = textures.beginMap(); map_end = textures.endMap(); for( ; map_iter != map_end; ++map_iter) { mTextures.push_back((*map_iter).second); mData += (*map_iter).first + " " + (*map_iter).second.asString() + "\n"; } }
void LLWLParamManager::addAllSkies(const LLWLParamKey::EScope scope, const LLSD& sky_presets) { for(LLSD::map_const_iterator iter = sky_presets.beginMap(); iter != sky_presets.endMap(); ++iter) { LLWLParamSet set; set.setAll(iter->second); mParamList[LLWLParamKey(iter->first, scope)] = set; } }
void LLCrashLogger::mergeLogs( LLSD src_sd ) { LLSD::map_iterator iter = src_sd.beginMap(); LLSD::map_iterator end = src_sd.endMap(); for( ; iter != end; ++iter) { mDebugLog[iter->first] = iter->second; } }
void LLUIString::setArgs(const LLSD& sd) { if (!sd.isMap()) return; for(LLSD::map_const_iterator sd_it = sd.beginMap(); sd_it != sd.endMap(); ++sd_it) { setArg(sd_it->first, sd_it->second.asString()); } format(); }
// virtual LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( const LLChannelDescriptors& channels, buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump) { PUMP_DEBUG; LLMemType m1(LLMemType::MTYPE_IO_HTTP_SERVER); if(eos) { PUMP_DEBUG; //mGotEOS = true; std::ostringstream ostr; std::string message = context[CONTEXT_RESPONSE]["statusMessage"]; int code = context[CONTEXT_RESPONSE]["statusCode"]; if (code < 200) { code = 200; message = "OK"; } ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; S32 content_length = buffer->countAfter(channels.in(), NULL); if(0 < content_length) { ostr << "Content-Length: " << content_length << "\r\n"; } // *NOTE: This guard can go away once the LLSD static map // iterator is available. Phoenix. 2008-05-09 LLSD headers = context[CONTEXT_RESPONSE][CONTEXT_HEADERS]; if(headers.isDefined()) { LLSD::map_iterator iter = headers.beginMap(); LLSD::map_iterator end = headers.endMap(); for(; iter != end; ++iter) { ostr << (*iter).first << ": " << (*iter).second.asString() << "\r\n"; } } ostr << "\r\n"; LLChangeChannel change(channels.in(), channels.out()); std::for_each(buffer->beginSegment(), buffer->endSegment(), change); std::string header = ostr.str(); buffer->prepend(channels.out(), (U8*)header.c_str(), header.size()); PUMP_DEBUG; return STATUS_DONE; } PUMP_DEBUG; return STATUS_OK; }
void GrowlManager::loadConfig() { std::string config_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "growl_notifications.xml"); if(config_file == "") { LL_WARNS("GrowlConfig") << "Couldn't find growl_notifications.xml" << LL_ENDL; return; } LL_INFOS("GrowlConfig") << "Loading growl notification config from " << config_file << LL_ENDL; llifstream configs(config_file); LLSD notificationLLSD; std::set<std::string> notificationTypes; notificationTypes.insert("Keyword Alert"); notificationTypes.insert("Instant Message received"); if(configs.is_open()) { LLSDSerialize::fromXML(notificationLLSD, configs); for(LLSD::map_iterator itr = notificationLLSD.beginMap(); itr != notificationLLSD.endMap(); ++itr) { GrowlNotification ntype; ntype.growlName = itr->second.get("GrowlName").asString(); notificationTypes.insert(ntype.growlName); if(itr->second.has("GrowlTitle")) ntype.growlTitle = itr->second.get("GrowlTitle").asString(); if(itr->second.has("GrowlBody")) ntype.growlBody = itr->second.get("GrowlBody").asString(); if(itr->second.has("UseDefaultTextForTitle")) ntype.useDefaultTextForTitle = itr->second.get("UseDefaultTextForTitle").asBoolean(); else ntype.useDefaultTextForTitle = false; if(itr->second.has("UseDefaultTextForBody")) ntype.useDefaultTextForBody = itr->second.get("UseDefaultTextForBody").asBoolean(); else ntype.useDefaultTextForBody = false; if(ntype.useDefaultTextForBody == false && ntype.useDefaultTextForTitle == false && ntype.growlBody == "" && ntype.growlTitle == "") { ntype.useDefaultTextForBody = true; } this->mNotifications[itr->first] = ntype; } configs.close(); this->mNotifier->registerApplication("Ascent Viewer", notificationTypes); } else { LL_WARNS("GrowlConfig") << "Couldn't open growl config file." << LL_ENDL; } }
void LLUIString::setArgs(const LLSD& sd) { LLFastTimer timer(FTM_UI_STRING); if (!sd.isMap()) return; for(LLSD::map_const_iterator sd_it = sd.beginMap(); sd_it != sd.endMap(); ++sd_it) { setArg(sd_it->first, sd_it->second.asString()); } dirty(); }
void LLPathfindingCharacterList::parseCharacterListData(const LLSD& pCharacterListData) { LLPathfindingObjectMap &objectMap = getObjectMap(); for (LLSD::map_const_iterator characterDataIter = pCharacterListData.beginMap(); characterDataIter != pCharacterListData.endMap(); ++characterDataIter) { const std::string& uuid(characterDataIter->first); const LLSD& characterData = characterDataIter->second; LLPathfindingObjectPtr character(new LLPathfindingCharacter(uuid, characterData)); objectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(uuid, character)); } }
void result(const LLSD& content) { if(!mRegion || LLHTTPClient::ResponderPtr(this) != mRegion->getHttpResponderPtr()) //region is removed or responder is not created. { return ; } LLSD::map_const_iterator iter; for(iter = content.beginMap(); iter != content.endMap(); ++iter) { mRegion->setCapability( iter->first, iter->second ); } }
//static std::string LLNotification::getSelectedOptionName(const LLSD& response) { for (LLSD::map_const_iterator response_it = response.beginMap(); response_it != response.endMap(); ++response_it) { if (response_it->second.isBoolean() && response_it->second.asBoolean()) { return response_it->first; } } return ""; }
void LLMultiSlider::setValue(const LLSD& value) { // only do if it's a map if(value.isMap()) { // add each value... the first in the map becomes the current LLSD::map_const_iterator mIt = value.beginMap(); mCurSlider = mIt->first; for(; mIt != value.endMap(); mIt++) { setSliderValue(mIt->first, (F32)mIt->second.asReal(), TRUE); } } }
void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification) { LLSD response = notification->getResponse(); for (LLSD::map_const_iterator response_it = response.beginMap(); response_it != response.endMap(); ++response_it) { if (response_it->second.isBoolean() && response_it->second.asBoolean()) { // that after multiple responses there can be many pressed buttons // need to process them all disableButtons(notification->getName(), response_it->first); } } }
void lggAutoCorrectFloater::updateItemsList() { entryList->deleteAllItems(); if((namesList->getAllSelected().size())<=0) { updateListControlsEnabled(FALSE); return; } updateListControlsEnabled(TRUE); std::string listName= namesList->getFirstSelected()->getColumn(0)->getValue().asString(); LLSD listData = LGGAutoCorrect::getInstance()->getAutoCorrectEntries(listName); childSetValue("em_ac_list_enabled",listData["enabled"].asBoolean()); childSetValue("em_ac_list_style",listData["wordStyle"].asBoolean()); childSetValue("em_ac_list_show",listData["announce"].asBoolean()); childSetValue("em_ac_text_name",listName); childSetValue("em_ac_text_author",listData["author"]); childSetValue("em_ac_priority",listData["priority"]); static S32 *countAuto= rebind_llcontrol<S32>("EmeraldAutoCorrectCount", &gSavedSettings, true); childSetValue("em_ac_stats",*countAuto); LLSD autoCorrects = listData["data"]; LLSD::map_const_iterator loc_it = autoCorrects.beginMap(); LLSD::map_const_iterator loc_end = autoCorrects.endMap(); for ( ; loc_it != loc_end; ++loc_it) { const std::string& wrong = (*loc_it).first; const std::string& right = (*loc_it).second; //std::string lentry(wrong+"=>"+right); LLSD element; element["id"] = wrong; LLSD& s_column = element["columns"][0]; s_column["column"] = "Search"; s_column["value"] = wrong; s_column["font"] = "SANSSERIF"; LLSD& r_column = element["columns"][1]; r_column["column"] = "Replace"; r_column["value"] = right; r_column["font"] = "SANSSERIF"; entryList->addElement(element, ADD_BOTTOM); } }
// static void LLFloaterBlacklist::loadFromSave() { std::string file_name = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "blacklist_sg1.xml"); llifstream xml_file(file_name); if(!xml_file.is_open()) return; LLSD data; if(LLSDSerialize::fromXML(data, xml_file) >= 1) { for(LLSD::map_iterator iter = data.beginMap(); iter != data.endMap(); ++iter) { blacklist_entries.insert(std::pair<LLUUID,LLSD>(LLUUID(iter->first),iter->second)); } updateBlacklists(); } xml_file.close(); }
void LLVoiceCallCapResponder::result(const LLSD& content) { LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID); if (channelp) { //*TODO: DEBUG SPAM LLSD::map_const_iterator iter; for(iter = content.beginMap(); iter != content.endMap(); ++iter) { LL_DEBUGS("Voice") << "LLVoiceCallCapResponder::result got " << iter->first << LL_ENDL; } channelp->setChannelInfo( content["voice_credentials"]["channel_uri"].asString(), content["voice_credentials"]["channel_credentials"].asString()); } }
virtual void post( LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const { LLSD result = LLApp::instance()->getOptionData( LLApp::PRIORITY_RUNTIME_OVERRIDE); LLSD::map_const_iterator iter = input.beginMap(); LLSD::map_const_iterator end = input.endMap(); for(; iter != end; ++iter) { result[(*iter).first] = (*iter).second; } LLApp::instance()->setOptionData( LLApp::PRIORITY_RUNTIME_OVERRIDE, result); response->result(result); }
void AISUpdate::parseEmbeddedLinks(const LLSD& links) { for(LLSD::map_const_iterator linkit = links.beginMap(), linkend = links.endMap(); linkit != linkend; ++linkit) { const LLUUID link_id((*linkit).first); const LLSD& link_map = (*linkit).second; if (mItemIds.end() == mItemIds.find(link_id)) { LL_DEBUGS("Inventory") << "Ignoring link not in items list " << link_id << LL_ENDL; } else { parseLink(link_map); } } }
void importFile(std::istream& istr) { LLSD data; S32 parse_count = LLSDSerialize::fromXMLDocument(data, istr); if(parse_count < 1) return; LLSD experiences = data["experiences"]; LLUUID public_key; LLSD::map_const_iterator it = experiences.beginMap(); for(; it != experiences.endMap() ; ++it) { public_key.set(it->first); sCache[public_key]=it->second; } LL_DEBUGS("ExperienceCache") << "importFile() loaded " << sCache.size() << LL_ENDL; }
/*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; }
void AISUpdate::parseEmbeddedItems(const LLSD& items) { // a map of items (_embedded in a category) for(LLSD::map_const_iterator itemit = items.beginMap(), itemend = items.endMap(); itemit != itemend; ++itemit) { const LLUUID item_id((*itemit).first); const LLSD& item_map = (*itemit).second; if (mItemIds.end() == mItemIds.find(item_id)) { LL_DEBUGS("Inventory") << "Ignoring item not in items list " << item_id << LL_ENDL; } else { parseItem(item_map); } } }
void AISUpdate::parseEmbeddedCategories(const LLSD& categories) { // a map of categories (_embedded in a category) for(LLSD::map_const_iterator categoryit = categories.beginMap(), categoryend = categories.endMap(); categoryit != categoryend; ++categoryit) { const LLUUID category_id((*categoryit).first); const LLSD& category_map = (*categoryit).second; if (mCategoryIds.end() == mCategoryIds.find(category_id)) { LL_DEBUGS("Inventory") << "Ignoring category not in categories list " << category_id << LL_ENDL; } else { parseCategory(category_map); } } }
void LLFloaterBlacklist::onClickLoad_continued(AIFilePicker* filepicker) { if (filepicker->hasFilename()) { std::string file_name = filepicker->getFilename(); llifstream xml_file(file_name); if(!xml_file.is_open()) return; LLSD data; if(LLSDSerialize::fromXML(data, xml_file) >= 1) { for(LLSD::map_iterator iter = data.beginMap(); iter != data.endMap(); ++iter) { blacklist_entries.insert(std::pair<LLUUID,LLSD>(LLUUID(iter->first),iter->second)); } updateBlacklists(); } xml_file.close(); } }
virtual void get( LLHTTPNode::ResponsePtr response, const LLSD& context) const { LLSD result; LLApp* app = LLApp::instance(); LLSD::map_const_iterator iter; LLSD::map_const_iterator end; for(int ii = LLApp::PRIORITY_COUNT - 1; ii >= 0; --ii) { LLSD options = app->getOptionData((LLApp::OptionPriority)ii); iter = options.beginMap(); end = options.endMap(); for(; iter != end; ++iter) { result[(*iter).first] = (*iter).second; } } response->result(result); }
void PhoenixViewerLink::msblacklist(U32 status,std::string body) { if(status != 200) { LL_WARNS("MSBlacklist") << "Something went wrong with the blacklist download status code " << status << LL_ENDL; } llofstream some_filea; std::string temp_filea = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,boost::lexical_cast<std::string,S32>(rand()) + ".xml.gz"); some_filea.open(temp_filea,std::ios_base::binary); some_filea.clear(); some_filea.write(body.c_str(),body.size()); some_filea.close(); std::string temp_fileb = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,blacklist_version + ".xml" ); if(gunzip_file(temp_filea, temp_fileb)) { LL_INFOS("MSBlacklist") << "Unzipped blacklist file" << LL_ENDL; llifstream istr(temp_fileb); LLSD data; if(LLSDSerialize::fromXML(data,istr) >= 1) { LL_INFOS("MSBlacklist") << body.size() << " bytes received, updating local blacklist" << LL_ENDL; for(LLSD::map_iterator itr = data.beginMap(); itr != data.endMap(); ++itr) { if(itr->second.has("name")) LLFloaterBlacklist::addEntry(LLUUID(itr->first),itr->second); } gSavedSettings.setString("PhoenixAssetBlacklistVersion",blacklist_version); } else LL_INFOS("MsBlacklist") << "Failed to parse:" << istr << LL_ENDL; } else LL_INFOS("MSBlacklist") << "Failed to unzip file." << LL_ENDL; LLFile::remove(temp_filea); LLFile::remove(temp_fileb); }