// static void LLPanelLogin::onSelectServer(LLUICtrl*, void*) { // *NOTE: The paramters for this method are ignored. // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) // calls this method. // The user twiddled with the grid choice ui. // apply the selection to the grid setting. std::string grid_label; S32 grid_index; LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); LLSD combo_val = combo->getValue(); if (LLSD::TypeInteger == combo_val.type()) { grid_index = combo->getValue().asInteger(); if ((S32)GRID_INFO_OTHER == grid_index) { // This happens if the user specifies a custom grid // via command line. grid_label = combo->getSimple(); } } else { // no valid selection, return other grid_index = (S32)GRID_INFO_OTHER; grid_label = combo_val.asString(); } // This new seelction will override preset uris // from the command line. LLViewerLogin* vl = LLViewerLogin::getInstance(); vl->resetURIs(); if(grid_index != GRID_INFO_OTHER) { vl->setGridChoice((EGridInfo)grid_index); } else { vl->setGridChoice(grid_label); } // grid changed so show new splash screen (possibly) loadLoginPage(); }
void LLPanelFriends::onClickExport(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; std::string agn; gAgent.getName(agn); std::string filename = agn+".friendlist"; LLFilePicker& picker = LLFilePicker::instance(); if(!picker.getSaveFile( LLFilePicker::FFSAVE_ALL, filename ) ) { // User canceled save. return; } filename = picker.getFirstFile(); std::vector<LLScrollListItem*> selected = panelp->mFriendsList->getAllData();//->getAllSelected(); LLSD llsd; //U32 count = 0; //std::string friendlist; for(std::vector<LLScrollListItem*>::iterator itr = selected.begin(); itr != selected.end(); ++itr) { LLSD fraind; std::string friend_name = (*itr)->getColumn(LIST_FRIEND_NAME)->getValue().asString(); std::string friend_uuid = (*itr)->getUUID().asString(); bool show_online_status = (*itr)->getColumn(LIST_VISIBLE_ONLINE)->getValue().asBoolean(); bool show_map_location = (*itr)->getColumn(LIST_VISIBLE_MAP)->getValue().asBoolean(); bool allow_modify_objects = (*itr)->getColumn(LIST_EDIT_MINE)->getValue().asBoolean(); fraind["name"] = friend_name; fraind["see_online"] = show_online_status; fraind["can_map"] = show_map_location; fraind["can_mod"] = allow_modify_objects; //friendlist += friend_name+"|"+friend_uuid+"|"+show_online_status+"|"+show_map_location+"|"+allow_modify_objects+"\n"; llsd[friend_uuid] = fraind; //count += 1; } LLViewerLogin* vl = LLViewerLogin::getInstance(); std::string grid_uri = vl->getCurrentGridURI(); //LLStringUtil::toLower(uris[0]); llsd["GRID"] = grid_uri; llofstream export_file; export_file.open(filename); LLSDSerialize::toPrettyXML(llsd, export_file); export_file.close(); }
void LLPanelLogin::loadLoginPage() { if (!sInstance) return; std::ostringstream oStr; LLViewerLogin* vl = LLViewerLogin::getInstance(); std::string login_page = vl->getLoginPageURI(); if (login_page.empty()) { login_page = sInstance->getString( "real_url" ); vl->setLoginPageURI(login_page); } oStr << login_page; // Use the right delimeter depending on how LLURI parses the URL LLURI login_page_uri = LLURI(login_page); std::string first_query_delimiter = "&"; if (login_page_uri.queryMap().size() == 0) { first_query_delimiter = "?"; } // Language std::string language = LLUI::getLanguage(); oStr << first_query_delimiter<<"lang=" << language; // First Login? if (gSavedSettings.getBOOL("FirstLoginThisInstall")) { oStr << "&firstlogin=TRUE"; } // Channel and Version std::string version = llformat("%d.%d.%d (%d)", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD); char* curl_channel = curl_escape(LL_CHANNEL, 0); char* curl_version = curl_escape(version.c_str(), 0); char* curl_t = curl_escape(LLAppViewer::instance()->getWindowTitle().c_str(), 0); oStr << "&channel=" << curl_channel; oStr << "&version=" << curl_version; oStr << "&t=" << curl_t; if(LL_CHANNEL != EMERALD_RELEASE_CHANNEL) oStr << "&unsupported=1"; curl_free(curl_channel); curl_free(curl_version); curl_free(curl_t); // grid=blah code was here. Due to the implementation of the Emerald login manager, sending // this information is a very bad idea. Don't do it. gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid()); gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor()); #if USE_VIEWER_AUTH LLURLSimString::sInstance.parse(); std::string location; std::string region; std::string password; if (LLURLSimString::parse()) { std::ostringstream oRegionStr; location = "specify"; oRegionStr << LLURLSimString::sInstance.mSimName << "/" << LLURLSimString::sInstance.mX << "/" << LLURLSimString::sInstance.mY << "/" << LLURLSimString::sInstance.mZ; region = oRegionStr.str(); } else { if (gSavedSettings.getBOOL("LoginLastLocation")) { location = "last"; } else { location = "home"; } } std::string firstname, lastname; if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3) { LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo"); firstname = cmd_line_login[0].asString(); lastname = cmd_line_login[1].asString(); password = cmd_line_login[2].asString(); } if (firstname.empty()) { firstname = gSavedSettings.getString("FirstName"); } if (lastname.empty()) { lastname = gSavedSettings.getString("LastName"); } char* curl_region = curl_escape(region.c_str(), 0); oStr <<"firstname=" << firstname << "&lastname=" << lastname << "&location=" << location << "®ion=" << curl_region; curl_free(curl_region); if (!password.empty()) { oStr << "&password="******"&password=$1$" << password; } if (gAutoLogin) { oStr << "&auto_login=TRUE"; } if (gSavedSettings.getBOOL("ShowStartLocation")) { oStr << "&show_start_location=TRUE"; } if (gSavedSettings.getBOOL("RememberPassword")) { oStr << "&remember_password=TRUE"; } BOOL show_server = sInstance ? sInstance->mShowServerCombo : FALSE; if (show_server || gSavedSettings.getBOOL("ForceShowGrid")) { oStr << "&show_grid=TRUE"; } #endif LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html"); // navigate to the "real" page web_browser->navigateTo( oStr.str(), "text/html" ); }
// static void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus) { if (!sInstance) { llwarns << "Attempted setFields with no login view shown" << llendl; return; } LLCheckBoxCtrl* remember_pass_check = sInstance->getChild<LLCheckBoxCtrl>("remember_check"); LLComboBox* login_combo = sInstance->getChild<LLComboBox>("first_name_combo"); login_combo->setLabel(entry.getFirstName()); login_combo->resetDirty(); login_combo->resetTextDirty(); LLLineEditor* last_name = sInstance->getChild<LLLineEditor>("last_name_edit"); last_name->setText(entry.getLastName()); last_name->resetDirty(); if (entry.getPassword().empty()) { sInstance->childSetText("password_edit", std::string("")); remember_pass_check->setValue(LLSD(false)); } else { const std::string filler("123456789!123456"); sInstance->childSetText("password_edit", filler); sInstance->mIncomingPassword = filler; sInstance->mMungedPassword = entry.getPassword(); remember_pass_check->setValue(LLSD(true)); } LLComboBox* server_combo = sInstance->getChild<LLComboBox>("server_combo"); if (server_combo->getSimple() != entry.getGridName()) // Avoid loops. { server_combo->setSimple(entry.getGridName()); // Same string as used in login_show(). } LLViewerLogin* vl = LLViewerLogin::getInstance(); if (entry.getGrid() == GRID_INFO_OTHER) { vl->setGridURI(entry.getGridURI().asString()); vl->setHelperURI(entry.getHelperURI().asString()); vl->setLoginPageURI(entry.getLoginPageURI().asString()); } EGridInfo entry_grid = entry.getGrid(); if (entry_grid == GRID_INFO_OTHER || entry_grid != vl->getGridChoice()) { vl->setGridChoice(entry_grid); // grid changed so show new splash screen (possibly) loadLoginPage(); } if (takeFocus) { giveFocus(); } }
// static void LLPanelLogin::onSelectServer(LLUICtrl*, void*) { // *NOTE: The parameters for this method are ignored. // This function is only called by one thread, so we can use a static here. static bool looping; if (looping) return; looping = true; // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) // calls this method. // The user twiddled with the grid choice ui. // apply the selection to the grid setting. std::string grid_name; S32 grid_index; LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); LLSD combo_val = combo->getValue(); if (LLSD::TypeInteger == combo_val.type()) { grid_index = combo->getValue().asInteger(); grid_name = combo->getSimple(); } else { // no valid selection, return other grid_index = (S32)GRID_INFO_OTHER; grid_name = combo_val.asString(); } // This new selection will override preset uris // from the command line. LLViewerLogin* vl = LLViewerLogin::getInstance(); if(grid_index != GRID_INFO_OTHER) { vl->setGridChoice((EGridInfo)grid_index); } else { vl->setGridChoice(grid_name); } // Find a saved login entry that uses this grid, if any. bool found = false; LLSavedLoginsList const& entries = sInstance->mLoginHistoryData.getEntries(); for (LLSavedLoginsList::const_reverse_iterator i = entries.rbegin(); i != entries.rend(); ++i) { if (!i->asLLSD().isMap()) { continue; } if (i->getGridName() == grid_name) { if (!vl->nameEditted()) { // Change the other fields to match this grid. LLPanelLogin::setFields(*i, false); } else // Probably creating a new account. { // Likely the current password is for a different grid. clearPassword(); } found = true; break; } } if (!found) { clearPassword(); // If the grid_name starts with 'http[s]://' then // we have to assume it's a new loginuri, set // on the commandline. if (grid_name.substr(0, 4) == "http") { // Use it as login uri. vl->setGridURI(grid_name); // And set the login page if it was given. std::string loginPage = gSavedSettings.getString("LoginPage"); std::string helperURI = gSavedSettings.getString("CmdLineHelperURI"); if (!loginPage.empty()) vl->setLoginPageURI(loginPage); if (!helperURI.empty()) vl->setHelperURI(helperURI); } } // grid changed so show new splash screen (possibly) loadLoginPage(); looping = false; }
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")) { LLViewerLogin* vl = LLViewerLogin::getInstance(); std::string grid_uri = vl->getCurrentGridURI(); std::string grid = grid_uri; 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(); }