From 3f6375ea527f206981661c83bc66b0350934a797 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 1 Oct 2009 06:05:55 -0700 Subject: Fixed inability to teleport to adult regions in Imprudence 1.2 (Ugly. Only use on 1.22 code base) --- linden/indra/newview/app_settings/settings.xml | 11 +++++++ linden/indra/newview/llagent.cpp | 26 +++++++++++++++++ linden/indra/newview/llagent.h | 1 + linden/indra/newview/llstartup.cpp | 40 ++++++++++++++++++++------ linden/indra/newview/llviewerregion.cpp | 16 +++++++++-- 5 files changed, 83 insertions(+), 11 deletions(-) (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index e9705de..7cc10af 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -5734,6 +5734,17 @@ Value 6.0 + PreferredMaturity + + Comment + Setting for the user's preferred maturity level. + Persist + 1 + Type + U32 + Value + 13 + PreviewAnimRect Comment diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index edcb82c..e6438f4 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp @@ -4894,6 +4894,32 @@ void LLAgent::setTeen(bool teen) } } +//static +void LLAgent::convertTextToMaturity(char text) // HACK: remove when based on 1.23 +{ + if ('A' == text) + { + mAccess = SIM_ACCESS_ADULT; + //return SIM_ACCESS_ADULT; + } + else if ('M'== text) + { + mAccess = SIM_ACCESS_MATURE; + //return SIM_ACCESS_MATURE; + } + else if ('P'== text) + { + mAccess = SIM_ACCESS_PG; + //return SIM_ACCESS_PG; + } + else + { + mAccess = SIM_ACCESS_MIN; + //return SIM_ACCESS_MIN; + } + gSavedSettings.setU32("PreferredMaturity", mAccess); +} + void LLAgent::buildFullname(std::string& name) const { if (mAvatarObject) diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h index d6854e4..bf0eeeb 100644 --- a/linden/indra/newview/llagent.h +++ b/linden/indra/newview/llagent.h @@ -255,6 +255,7 @@ public: U8 getGodLevel() const; bool isTeen() const; void setTeen(bool teen); + void convertTextToMaturity(char text);// HACK: remove when based on 1.23 BOOL isGroupTitleHidden() const { return mHideGroupTitle; } BOOL isGroupMember() const { return !mGroupID.isNull(); } // This is only used for building titles! const LLUUID &getGroupID() const { return mGroupID; } diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 8ec5d98..346f7dd 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -1425,20 +1425,13 @@ bool idle_startup() gSavedSettings.setBOOL("RememberPassword", remember_password); // This fixes Imprudence 1.2 thinking it's a teen. - // Will need updating for the 1.23 merge. + // Will need fixing for the 1.23 merge. // this is their actual ability to access content text = LLUserAuth::getInstance()->getResponse("agent_access_max"); if (!text.empty()) { // agent_access can be 'A', 'M', and 'PG'. - if (text[0] == 'PG') - { - gAgent.setTeen(true); - } - else - { - gAgent.setTeen(false); - } + gAgent.convertTextToMaturity(text[0]); } else // we're on an older sim version (prolly an opensim) { @@ -2623,6 +2616,35 @@ bool idle_startup() gDebugView->mFastTimerView->setVisible(TRUE); #endif + // HACK: remove this when based on 1.23 + // Send our preferred maturity. + // Update agent access preference on the server + std::string url = gAgent.getRegion()->getCapability("UpdateAgentInformation"); + if (!url.empty()) + { + U32 preferredMaturity = gSavedSettings.getU32("PreferredMaturity"); + // Set new access preference + LLSD access_prefs = LLSD::emptyMap(); + if (preferredMaturity == SIM_ACCESS_PG) + { + access_prefs["max"] = "PG"; + } + else if (preferredMaturity == SIM_ACCESS_MATURE) + { + access_prefs["max"] = "M"; + } + if (preferredMaturity == SIM_ACCESS_ADULT) + { + access_prefs["max"] = "A"; + } + + LLSD body = LLSD::emptyMap(); + body["access_prefs"] = access_prefs; + llinfos << "Sending access prefs update to " << (access_prefs["max"].asString()) << " via capability to: " + << url << llendl; + LLHTTPClient::post(url, body, new LLHTTPClient::Responder()); // Ignore response + } + LLAppViewer::instance()->initMainloopTimeout("Mainloop Init"); return TRUE; diff --git a/linden/indra/newview/llviewerregion.cpp b/linden/indra/newview/llviewerregion.cpp index 1c527e0..0ba0879 100644 --- a/linden/indra/newview/llviewerregion.cpp +++ b/linden/indra/newview/llviewerregion.cpp @@ -542,6 +542,7 @@ std::string LLViewerRegion::regionFlagsToString(U32 flags) const char* SIM_ACCESS_STR[] = { "Free Trial", "PG", "Mature", + "Adult", "Offline", "Unknown" }; @@ -559,12 +560,15 @@ std::string LLViewerRegion::accessToString(U8 sim_access) case SIM_ACCESS_MATURE: return SIM_ACCESS_STR[2]; - case SIM_ACCESS_DOWN: + case SIM_ACCESS_ADULT: return SIM_ACCESS_STR[3]; + case SIM_ACCESS_DOWN: + return SIM_ACCESS_STR[4]; + case SIM_ACCESS_MIN: default: - return SIM_ACCESS_STR[4]; + return SIM_ACCESS_STR[5]; } } @@ -584,6 +588,10 @@ U8 LLViewerRegion::stringToAccess(const std::string& access_str) { sim_access = SIM_ACCESS_MATURE; } + else if (access_str == SIM_ACCESS_STR[3]) + { + sim_access = SIM_ACCESS_ADULT; + } return sim_access; } @@ -601,6 +609,9 @@ std::string LLViewerRegion::accessToShortString(U8 sim_access) case SIM_ACCESS_MATURE: return "M"; + case SIM_ACCESS_ADULT: + return "A"; + case SIM_ACCESS_MIN: default: return "U"; @@ -1419,6 +1430,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("SendUserReportWithScreenshot"); capabilityNames.append("ServerReleaseNotes"); capabilityNames.append("StartGroupProposal"); + capabilityNames.append("UpdateAgentInformation"); capabilityNames.append("UpdateAgentLanguage"); capabilityNames.append("UpdateGestureAgentInventory"); capabilityNames.append("UpdateNotecardAgentInventory"); -- cgit v1.1