// static bool LLURLDispatcherImpl::dispatchApp(const std::string& url, bool right_mouse, LLMediaCtrl* web, bool trusted_browser) { // ensure the URL is in the secondlife:///app/ format if (!LLSLURL::isSLURLCommand(url)) { return false; } LLURI uri(url); LLSD pathArray = uri.pathArray(); pathArray.erase(0); // erase "app" std::string cmd = pathArray.get(0); pathArray.erase(0); // erase "cmd" bool handled = LLCommandDispatcher::dispatch( cmd, pathArray, uri.queryMap(), web, trusted_browser); // alert if we didn't handle this secondlife:///app/ SLURL // (but still return true because it is a valid app SLURL) if (! handled) { LLNotificationsUtil::add("UnsupportedCommandSLURL"); } return true; }
void SDTestObject::test<10>() // map operations { SDCleanupCheck check; LLSD v; ensure("undefined has no members", !v.has("amy")); ensure("undefined get() is undefined", v.get("bob").isUndefined()); v = LLSD::emptyMap(); ensure("empty map is a map", v.isMap()); ensure("empty map has no members", !v.has("cam")); ensure("empty map get() is undefined", v.get("don").isUndefined()); v.clear(); v.insert("eli", 43); ensure("insert converts to map", v.isMap()); ensure("inserted key is present", v.has("eli")); ensureTypeAndValue("inserted value", v.get("eli"), 43); v.insert("fra", false); ensure("first key still present", v.has("eli")); ensure("second key is present", v.has("fra")); ensureTypeAndValue("first value", v.get("eli"), 43); ensureTypeAndValue("second value", v.get("fra"), false); v.erase("eli"); ensure("first key now gone", !v.has("eli")); ensure("second key still present", v.has("fra")); ensure("first value gone", v.get("eli").isUndefined()); ensureTypeAndValue("second value sill there", v.get("fra"), false); v.erase("fra"); ensure("second key now gone", !v.has("fra")); ensure("second value gone", v.get("fra").isUndefined()); v["gil"] = (std::string)"good morning"; ensure("third key present", v.has("gil")); ensureTypeAndValue("third key value", v.get("gil"), "good morning"); const LLSD& cv = v; // FIX ME IF POSSIBLE ensure("missing key", cv["ham"].isUndefined()); ensure("key not present", !v.has("ham")); LLSD w = 43; const LLSD& cw = w; // FIX ME IF POSSIBLE int i = cw["ian"]; ensureTypeAndValue("other missing value", i, 0); ensure("other missing key", !w.has("ian")); ensure("no conversion", w.isInteger()); LLSD x; x = v; ensure("copy map type", x.isMap()); ensureTypeAndValue("copy map value gil", x.get("gil"), "good morning"); }
// // LLSD functions // void LLMediaEntry::asLLSD(LLSD& sd) const { // "general" fields sd[ALT_IMAGE_ENABLE_KEY] = mAltImageEnable; sd[CONTROLS_KEY] = (LLSD::Integer)mControls; sd[CURRENT_URL_KEY] = mCurrentURL; sd[HOME_URL_KEY] = mHomeURL; sd[AUTO_LOOP_KEY] = mAutoLoop; sd[AUTO_PLAY_KEY] = mAutoPlay; sd[AUTO_SCALE_KEY] = mAutoScale; sd[AUTO_ZOOM_KEY] = mAutoZoom; sd[FIRST_CLICK_INTERACT_KEY] = mFirstClickInteract; sd[WIDTH_PIXELS_KEY] = mWidthPixels; sd[HEIGHT_PIXELS_KEY] = mHeightPixels; // "security" fields sd[WHITELIST_ENABLE_KEY] = mWhiteListEnable; sd.erase(WHITELIST_KEY); for (U32 i=0; i<mWhiteList.size(); i++) { sd[WHITELIST_KEY].append(mWhiteList[i]); } // "permissions" fields sd[PERMS_INTERACT_KEY] = mPermsInteract; sd[PERMS_CONTROL_KEY] = mPermsControl; }
// static void LLPanelLandMedia::onClickRemoveURLFilter(void *data) { LLPanelLandMedia* panelp = (LLPanelLandMedia*)data; if (panelp && panelp->mURLFilterList) { LLParcel* parcel = panelp->mParcel->getParcel(); if (parcel) { LLSD list = parcel->getMediaURLFilterList(); std::vector<LLScrollListItem*> domains = panelp->mURLFilterList->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = domains.begin(); iter != domains.end(); iter++) { LLScrollListItem* item = *iter; const std::string domain = item->getValue().asString(); for(S32 i = 0; i < list.size(); i++) { if (list[i].asString() == domain) { list.erase(i); break; } } } parcel->setMediaURLFilterList(list); LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); panelp->refresh(); } } }
bool JCLSLBridge::lsltobridge(std::string message, std::string from_name, LLUUID source_id, LLUUID owner_id) { if(message == "someshit") { ////cmdline_printchat("got someshit from "+source_id.asString()); return true; }else { std::string clip = message.substr(0,5); if(clip == "#@#@#") { std::string rest = message.substr(5); LLSD arguments = JCLSLBridge::parse_string_to_list(rest, '|'); ////cmdline_printchat(std::string(LLSD::dumpXML(arguments))); U32 call = atoi(arguments[0].asString().c_str()); if(call) { arguments.erase(0); ////cmdline_printchat(std::string(LLSD::dumpXML(arguments))); callback_fire(call, arguments); return true; } }else if(clip == "rotat") { LLViewerObject* obj = gObjectList.findObject(source_id); if(obj) { if(obj->isAttachment()) { if(owner_id == gAgent.getID()) { std::string rot = message.substr(5); LLQuaternion rotation; if(LLQuaternion::parseQuat(rot,&rotation)) { //cmdline_printchat("script rotating!"); gAgent.getAvatarObject()->setRotation(rotation,TRUE); }else { //cmdline_printchat("script rotate failed"); } } } } }else if(message.substr(0,3) == "l2c") { std::string lolnum = message.substr(3); //cmdline_printchat("num="+lolnum); l2c = atoi(lolnum.c_str()); //cmdline_printchat("rnum="+llformat("%d",l2c)); l2c_inuse = true; return true; } } return false; }
// static bool LLURLDispatcherImpl::dispatchApp(const std::string& url, bool right_mouse, LLWebBrowserCtrl* web, bool trusted_browser) { if (!isSLURL(url)) { return false; } LLURI uri(url); LLSD pathArray = uri.pathArray(); pathArray.erase(0); // erase "app" std::string cmd = pathArray.get(0); pathArray.erase(0); // erase "cmd" bool handled = LLCommandDispatcher::dispatch( cmd, pathArray, uri.queryMap(), web, trusted_browser); return handled; }
// static bool LLURLDispatcherImpl::dispatchApp(const std::string& url, bool right_mouse, LLMediaCtrl* web, bool trusted_browser) { // we support legacy secondlife:///app links as well as inworldz:/// *only* in the text editor -- MC if (isIZURL(url) || isSLURL(url)) { LLURI uri(url); LLSD pathArray = uri.pathArray(); pathArray.erase(0); // erase "app" std::string cmd = pathArray.get(0); pathArray.erase(0); // erase "cmd" bool handled = LLCommandDispatcher::dispatch( cmd, pathArray, uri.queryMap(), web, trusted_browser); return handled; } return false; }
void LLPanelProfile::onOpen(const LLSD& key) { // open the desired panel if (key.has("open_tab_name")) { getTabContainer()[PANEL_PICKS]->onClosePanel(); // onOpen from selected panel will be called from onTabSelected callback getTabCtrl()->selectTabByName(key["open_tab_name"]); } else { getTabCtrl()->getCurrentPanel()->onOpen(getAvatarId()); } // support commands to open further pieces of UI if (key.has("show_tab_panel")) { std::string panel = key["show_tab_panel"].asString(); if (panel == "create_classified") { LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]); if (picks) { picks->createNewClassified(); } } else if (panel == "classified_details") { LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]); if (picks) { LLSD params = key; params.erase("show_tab_panel"); params.erase("open_tab_name"); picks->openClassifiedInfo(params); } } } }
void LLPanelProfile::onOpen(const LLSD& key) { getTabContainer()[PANEL_PICKS]->onOpen(getAvatarId()); // support commands to open further pieces of UI if (key.has("show_tab_panel")) { std::string panel = key["show_tab_panel"].asString(); if (panel == "create_classified") { LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]); if (picks) { picks->createNewClassified(); } } else if (panel == "classified_details") { LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]); if (picks) { LLSD params = key; params.erase("show_tab_panel"); params.erase("open_tab_name"); picks->openClassifiedInfo(params); } } else if (panel == "edit_classified") { LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]); if (picks) { LLSD params = key; params.erase("show_tab_panel"); params.erase("open_tab_name"); picks->openClassifiedEdit(params); } } else if (panel == "create_pick") { LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]); if (picks) { picks->createNewPick(); } } else if (panel == "edit_pick") { LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]); if (picks) { LLSD params = key; params.erase("show_tab_panel"); params.erase("open_tab_name"); picks->openPickEdit(params); } } } }
virtual void del( LLHTTPNode::ResponsePtr response, const LLSD& context) const { std::string name = context["request"]["wildcard"]["option-name"]; LLSD options = LLApp::instance()->getOptionData( LLApp::PRIORITY_RUNTIME_OVERRIDE); options.erase(name); LLApp::instance()->setOptionData( LLApp::PRIORITY_RUNTIME_OVERRIDE, options); response->result(LLSD()); }
void LLPanelFriends::FriendImportState(LLUUID id, bool accepted) { std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat"); if(LLFile::isfile(importstate)) { llifstream importer(importstate); LLSD data; LLSDSerialize::fromXMLDocument(data, importer); if(!data.has(id.asString()))return; LLSD user = data[id.asString()]; if(accepted) { BOOL can_map = user["can_map"].asBoolean(); BOOL can_mod = user["can_mod"].asBoolean(); BOOL see_online = user["see_online"].asBoolean(); S32 rights = 0; if(can_map)rights |= LLRelationship::GRANT_MAP_LOCATION; if(can_mod)rights |= LLRelationship::GRANT_MODIFY_OBJECTS; if(see_online)rights |= LLRelationship::GRANT_ONLINE_STATUS; if(is_agent_friend(id))//is this legit shit yo { const LLRelationship* friend_status = LLAvatarTracker::instance().getBuddyInfo(id); if(friend_status) { S32 tr = friend_status->getRightsGrantedTo(); if(tr != rights) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_GrantUserRights); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUID(_PREHASH_AgentID, gAgent.getID()); msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Rights); msg->addUUID(_PREHASH_AgentRelated, id); msg->addS32(_PREHASH_RelatedRights, rights); gAgent.sendReliableMessage(); } } } } data.erase(id.asString());//if they declined then we need to forget about it, if they accepted it is done llofstream export_file; export_file.open(importstate); LLSDSerialize::toPrettyXML(data, export_file); export_file.close(); } }
void SDTestObject::test<11>() // array operations { SDCleanupCheck check; LLSD v; ensure_equals("undefined has no size", v.size(), 0); ensure("undefined get() is undefined", v.get(0).isUndefined()); v = LLSD::emptyArray(); ensure("empty array is an array", v.isArray()); ensure_equals("empty array has no size", v.size(), 0); ensure("empty map get() is undefined", v.get(0).isUndefined()); v.clear(); v.append(88); v.append("noodle"); v.append(true); ensure_equals("appened array size", v.size(), 3); ensure("append array is an array", v.isArray()); ensureTypeAndValue("append 0", v[0], 88); ensureTypeAndValue("append 1", v[1], "noodle"); ensureTypeAndValue("append 2", v[2], true); v.insert(0, 77); v.insert(2, "soba"); v.insert(4, false); ensure_equals("inserted array size", v.size(), 6); ensureTypeAndValue("post insert 0", v[0], 77); ensureTypeAndValue("post insert 1", v[1], 88); ensureTypeAndValue("post insert 2", v[2], "soba"); ensureTypeAndValue("post insert 3", v[3], "noodle"); ensureTypeAndValue("post insert 4", v[4], false); ensureTypeAndValue("post insert 5", v[5], true); ensureTypeAndValue("get 1", v.get(1), 88); v.set(1, "hot"); ensureTypeAndValue("set 1", v.get(1), "hot"); v.erase(3); ensure_equals("post erase array size", v.size(), 5); ensureTypeAndValue("post erase 0", v[0], 77); ensureTypeAndValue("post erase 1", v[1], "hot"); ensureTypeAndValue("post erase 2", v[2], "soba"); ensureTypeAndValue("post erase 3", v[3], false); ensureTypeAndValue("post erase 4", v[4], true); v.append(34); ensure_equals("size after append", v.size(), 6); ensureTypeAndValue("post append 5", v[5], 34); LLSD w; w = v; ensure("copy array type", w.isArray()); ensure_equals("copy array size", w.size(), 6); ensureTypeAndValue("copy array 0", w[0], 77); ensureTypeAndValue("copy array 1", w[1], "hot"); ensureTypeAndValue("copy array 2", w[2], "soba"); ensureTypeAndValue("copy array 3", w[3], false); ensureTypeAndValue("copy array 4", w[4], true); ensureTypeAndValue("copy array 5", w[5], 34); }
void llsdutil_object::test<9>() { set_test_name("llsd_matches"); // for this test, construct a map of all possible LLSD types LLSD map; map.insert("empty", LLSD()); map.insert("Boolean", LLSD::Boolean()); map.insert("Integer", LLSD::Integer(0)); map.insert("Real", LLSD::Real(0.0)); map.insert("String", LLSD::String("bah")); map.insert("NumString", LLSD::String("1")); map.insert("UUID", LLSD::UUID()); map.insert("Date", LLSD::Date()); map.insert("URI", LLSD::URI()); map.insert("Binary", LLSD::Binary()); map.insert("Map", LLSD().with("foo", LLSD())); // Only an empty array can be constructed on the fly LLSD array; array.append(LLSD()); map.insert("Array", array); // These iterators are declared outside our various for loops to avoid // fatal MSVC warning: "I used to be broken, but I'm all better now!" LLSD::map_const_iterator mi, mend(map.endMap()); /*-------------------------- llsd_matches --------------------------*/ // empty prototype matches anything for (mi = map.beginMap(); mi != mend; ++mi) { ensure_equals(std::string("empty matches ") + mi->first, llsd_matches(LLSD(), mi->second), ""); } LLSD proto_array, data_array; for (int i = 0; i < 3; ++i) { proto_array.append(LLSD()); data_array.append(LLSD()); } // prototype array matches only array for (mi = map.beginMap(); mi != mend; ++mi) { ensure(std::string("array doesn't match ") + mi->first, ! llsd_matches(proto_array, mi->second).empty()); } // data array must be at least as long as prototype array proto_array.append(LLSD()); ensure_equals("data array too short", llsd_matches(proto_array, data_array), "Array size 4 required instead of Array size 3"); data_array.append(LLSD()); ensure_equals("data array just right", llsd_matches(proto_array, data_array), ""); data_array.append(LLSD()); ensure_equals("data array longer", llsd_matches(proto_array, data_array), ""); // array element matching data_array[0] = LLSD::String(); ensure_equals("undefined prototype array entry", llsd_matches(proto_array, data_array), ""); proto_array[0] = LLSD::Binary(); ensure_equals("scalar prototype array entry", llsd_matches(proto_array, data_array), "[0]: Binary required instead of String"); data_array[0] = LLSD::Binary(); ensure_equals("matching prototype array entry", llsd_matches(proto_array, data_array), ""); // build a coupla maps LLSD proto_map, data_map; data_map["got"] = LLSD(); data_map["found"] = LLSD(); for (LLSD::map_const_iterator dmi(data_map.beginMap()), dmend(data_map.endMap()); dmi != dmend; ++dmi) { proto_map[dmi->first] = dmi->second; } proto_map["foo"] = LLSD(); proto_map["bar"] = LLSD(); // prototype map matches only map for (mi = map.beginMap(); mi != mend; ++mi) { ensure(std::string("map doesn't match ") + mi->first, ! llsd_matches(proto_map, mi->second).empty()); } // data map must contain all keys in prototype map std::string error(llsd_matches(proto_map, data_map)); ensure_contains("missing keys", error, "missing keys"); ensure_contains("missing foo", error, "foo"); ensure_contains("missing bar", error, "bar"); ensure_does_not_contain("found found", error, "found"); ensure_does_not_contain("got got", error, "got"); data_map["bar"] = LLSD(); error = llsd_matches(proto_map, data_map); ensure_contains("missing foo", error, "foo"); ensure_does_not_contain("got bar", error, "bar"); data_map["foo"] = LLSD(); ensure_equals("data map just right", llsd_matches(proto_map, data_map), ""); data_map["extra"] = LLSD(); ensure_equals("data map with extra", llsd_matches(proto_map, data_map), ""); // map element matching data_map["foo"] = LLSD::String(); ensure_equals("undefined prototype map entry", llsd_matches(proto_map, data_map), ""); proto_map["foo"] = LLSD::Binary(); ensure_equals("scalar prototype map entry", llsd_matches(proto_map, data_map), "['foo']: Binary required instead of String"); data_map["foo"] = LLSD::Binary(); ensure_equals("matching prototype map entry", llsd_matches(proto_map, data_map), ""); // String { static const char* matches[] = { "String", "NumString", "Boolean", "Integer", "Real", "UUID", "Date", "URI" }; test_matches("String", map, boost::begin(matches), boost::end(matches)); } // Boolean, Integer, Real static const char* numerics[] = { "Boolean", "Integer", "Real" }; for (const char **ni = boost::begin(numerics), **nend = boost::end(numerics); ni != nend; ++ni) { static const char* matches[] = { "Boolean", "Integer", "Real", "String", "NumString" }; test_matches(*ni, map, boost::begin(matches), boost::end(matches)); } // UUID { static const char* matches[] = { "UUID", "String", "NumString" }; test_matches("UUID", map, boost::begin(matches), boost::end(matches)); } // Date { static const char* matches[] = { "Date", "String", "NumString" }; test_matches("Date", map, boost::begin(matches), boost::end(matches)); } // URI { static const char* matches[] = { "URI", "String", "NumString" }; test_matches("URI", map, boost::begin(matches), boost::end(matches)); } // Binary { static const char* matches[] = { "Binary" }; test_matches("Binary", map, boost::begin(matches), boost::end(matches)); } /*-------------------------- llsd_equals ---------------------------*/ // Cross-product of each LLSD type with every other for (LLSD::map_const_iterator lmi(map.beginMap()), lmend(map.endMap()); lmi != lmend; ++lmi) { for (LLSD::map_const_iterator rmi(map.beginMap()), rmend(map.endMap()); rmi != rmend; ++rmi) { // Name this test based on the map keys naming the types of // interest, e.g "String::Integer". // We expect the values (xmi->second) to be equal if and only // if the type names (xmi->first) are equal. ensure(STRINGIZE(lmi->first << "::" << rmi->first), bool(lmi->first == rmi->first) == bool(llsd_equals(lmi->second, rmi->second))); } } // Array cases LLSD rarray; rarray.append(1.0); rarray.append(2); rarray.append("3"); LLSD larray(rarray); ensure("llsd_equals(equal arrays)", llsd_equals(larray, rarray)); rarray[2] = "4"; ensure("llsd_equals(different [2])", ! llsd_equals(larray, rarray)); rarray = larray; rarray.append(LLSD::Date()); ensure("llsd_equals(longer right array)", ! llsd_equals(larray, rarray)); rarray = larray; rarray.erase(2); ensure("llsd_equals(shorter right array)", ! llsd_equals(larray, rarray)); // Map cases LLSD rmap; rmap["San Francisco"] = 65; rmap["Phoenix"] = 92; rmap["Boston"] = 77; LLSD lmap(rmap); ensure("llsd_equals(equal maps)", llsd_equals(lmap, rmap)); rmap["Boston"] = 80; ensure("llsd_equals(different [\"Boston\"])", ! llsd_equals(lmap, rmap)); rmap = lmap; rmap["Atlanta"] = 95; ensure("llsd_equals(superset right map)", ! llsd_equals(lmap, rmap)); rmap = lmap; lmap["Seattle"] = 72; ensure("llsd_equals(superset left map)", ! llsd_equals(lmap, rmap)); }
void LLPanelFriends::onClickImport(void* user_data) //THIS CODE IS DESIGNED SO THAT EXP/IMP BETWEEN GRIDS WILL FAIL //because assuming someone having the same name on another grid is the same person is generally a bad idea //i might add the option to query the user as to intelligently detecting matching names on a alternative grid // jcool410 { //LLPanelFriends* panelp = (LLPanelFriends*)user_data; //is_agent_friend( const std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_ALL); if (filename.empty()) return; llifstream importer(filename); LLSD data; LLSDSerialize::fromXMLDocument(data, importer); if(data.has("GRID")) { std::string grid = gHippoGridManager->getConnectedGrid()->getLoginUri(); if(grid != data["GRID"])return; data.erase("GRID"); } #if LL_WINDOWS std::string file = filename.substr(filename.find_last_of("\\")+1); #else std::string file = filename.substr(filename.find_last_of("/")+1); #endif std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat"); llifstream stateload(importstate); LLSD importstatellsd; LLSDSerialize::fromXMLDocument(importstatellsd, stateload); //LLMessageSystem* msg = gMessageSystem; LLSD newdata; LLSD::map_const_iterator iter; for(iter = data.beginMap(); iter != data.endMap(); ++iter) {//first= var second = val LLSD content = iter->second; if(!content.has("name"))continue; if(!content.has("see_online"))continue; if(!content.has("can_map"))continue; if(!content.has("can_mod"))continue; LLUUID agent_id = LLUUID(iter->first); if(merging && importstatellsd.has(agent_id.asString()))continue;//dont need to request what weve already requested from another list import and have not got a reply yet std::string agent_name = content["name"]; if(!is_agent_friend(agent_id))//dont need to request what we have { if(merging)importstatellsd[agent_id.asString()] = content;//MERGEEEE requestFriendship(agent_id, agent_name, "Imported from "+file); newdata[iter->first] = iter->second; }else { //data.erase(iter->first); //--iter;//god help us all } } data = newdata; newdata = LLSD(); if(!merging) { merging = true;//this hack is to support importing multiple account lists without spamming users but considering LLs fail in forcing silent declines importstatellsd = data; } llofstream export_file; export_file.open(importstate); LLSDSerialize::toPrettyXML(importstatellsd, export_file); export_file.close(); }
//THIS CODE IS DESIGNED SO THAT EXP/IMP BETWEEN GRIDS WILL FAIL //because assuming someone having the same name on another grid is the same person is generally a bad idea //i might add the option to query the user as to intelligently detecting matching names on a alternative grid // jcool410 void LLPanelFriends::onClickImport_filepicker_continued(AIFilePicker* filepicker) { if (!filepicker->hasFilename()) return; std::string filename = filepicker->getFilename(); llifstream importer(filename); LLSD data; LLSDSerialize::fromXMLDocument(data, importer); if(data.has("GRID")) { std::string grid = gHippoGridManager->getConnectedGrid()->getLoginUri(); if(grid != data["GRID"])return; data.erase("GRID"); } #if LL_WINDOWS std::string file = filename.substr(filename.find_last_of("\\")+1); #else std::string file = filename.substr(filename.find_last_of("/")+1); #endif std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat"); llifstream stateload(importstate); LLSD importstatellsd; LLSDSerialize::fromXMLDocument(importstatellsd, stateload); //LLMessageSystem* msg = gMessageSystem; LLSD newdata; LLSD::map_const_iterator iter; for(iter = data.beginMap(); iter != data.endMap(); ++iter) {//first= var second = val LLSD content = iter->second; if(!content.has("name"))continue; if(!content.has("see_online"))continue; if(!content.has("can_map"))continue; if(!content.has("can_mod"))continue; LLUUID agent_id = LLUUID(iter->first); if(merging && importstatellsd.has(agent_id.asString()))continue;//dont need to request what weve already requested from another list import and have not got a reply yet std::string agent_name = content["name"]; if(!is_agent_friend(agent_id))//dont need to request what we have { if(merging)importstatellsd[agent_id.asString()] = content;//MERGEEEE requestFriendship(agent_id, agent_name, "Imported from "+file); newdata[iter->first] = iter->second; }else { //data.erase(iter->first); //--iter;//god help us all } } data = newdata; newdata = LLSD(); if(!merging) { merging = true;//this hack is to support importing multiple account lists without spamming users but considering LLs fail in forcing silent declines importstatellsd = data; } llofstream export_file; export_file.open(importstate); LLSDSerialize::toPrettyXML(importstatellsd, export_file); export_file.close(); }