diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-05-17 17:12:00 -0700 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-05-17 17:12:00 -0700 |
commit | 90c6b871c49e5936639cfc181d6119fc1a8a3f08 (patch) | |
tree | 23870b5d5f840aebd7af9e72bd143e6a50601d53 /indra/newview | |
parent | cf0a6a61bd44b4becfa81eb3e0c6b16bc42c4c44 (diff) |
EXP-1928: Constructing the new maturity preferences flow for the case of a teleport via lure (which cannot be restared).
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llagent.cpp | 128 | ||||
-rw-r--r-- | indra/newview/llagent.h | 1 | ||||
-rwxr-xr-x | indra/newview/llviewermessage.cpp | 45 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 25 |
4 files changed, 153 insertions, 46 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index b109749688..340629e404 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -118,7 +118,10 @@ public: LLTeleportRequest(); virtual ~LLTeleportRequest(); - virtual void doTeleport() = 0; + virtual bool canRestartTeleport(); + + virtual void startTeleport() = 0; + virtual void restartTeleport(); protected: @@ -132,7 +135,10 @@ public: LLTeleportRequestViaLandmark(const LLUUID &pLandmarkId); virtual ~LLTeleportRequestViaLandmark(); - virtual void doTeleport(); + virtual bool canRestartTeleport(); + + virtual void startTeleport(); + virtual void restartTeleport(); protected: inline const LLUUID &getLandmarkId() const {return mLandmarkId;}; @@ -147,7 +153,9 @@ public: LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike); virtual ~LLTeleportRequestViaLure(); - virtual void doTeleport(); + virtual bool canRestartTeleport(); + + virtual void startTeleport(); protected: inline BOOL isLureGodLike() const {return mIsLureGodLike;}; @@ -162,7 +170,10 @@ public: LLTeleportRequestViaLocation(const LLVector3d &pPosGlobal); virtual ~LLTeleportRequestViaLocation(); - virtual void doTeleport(); + virtual bool canRestartTeleport(); + + virtual void startTeleport(); + virtual void restartTeleport(); protected: inline const LLVector3d &getPosGlobal() const {return mPosGlobal;}; @@ -178,7 +189,10 @@ public: LLTeleportRequestViaLocationLookAt(const LLVector3d &pPosGlobal); virtual ~LLTeleportRequestViaLocationLookAt(); - virtual void doTeleport(); + virtual bool canRestartTeleport(); + + virtual void startTeleport(); + virtual void restartTeleport(); protected: @@ -186,7 +200,6 @@ private: }; - //-------------------------------------------------------------------- // Statics // @@ -3602,11 +3615,16 @@ bool LLAgent::teleportCore(bool is_local) return true; } +bool LLAgent::hasRestartableFailedTeleportRequest() +{ + return hasFailedTeleportRequest() && mFailedTeleportRequest->canRestartTeleport(); +} + void LLAgent::restartFailedTeleportRequest() { - if (hasFailedTeleportRequest()) + if (hasRestartableFailedTeleportRequest()) { - mFailedTeleportRequest->doTeleport(); + mFailedTeleportRequest->restartTeleport(); } } @@ -3688,7 +3706,7 @@ void LLAgent::teleportRequest( void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) { mCurrentTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLandmark(landmark_asset_id)); - mCurrentTeleportRequest->doTeleport(); + mCurrentTeleportRequest->startTeleport(); } void LLAgent::doTeleportViaLandmark(const LLUUID& landmark_asset_id) @@ -3708,29 +3726,8 @@ void LLAgent::doTeleportViaLandmark(const LLUUID& landmark_asset_id) void LLAgent::teleportViaLure(const LLUUID& lure_id, BOOL godlike) { -#if 0 - // stinson 05/15/2012 : cannot restart a teleport via lure because of server-side restrictions - // The current scenario is as follows: - // 1. User A initializes a request for User B to teleport via lure - // 2. User B accepts the teleport via lure request - // 3. The server sees the init request from User A and the accept request from User B and matches them up - // 4. The server then removes the paired requests up from the "queue" - // 5. The server then fails User B's teleport for reason of maturity level (for example) - // 6. User B's viewer prompts user to increase their maturity level profile value. - // 7. User B confirms and accepts increase in maturity level - // 8. User B's viewer then attempts to teleport via lure again - // 9. This fails on the server because User A's initial request has been removed from the "queue" in step 4 mCurrentTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLure(lure_id, godlike)); - mCurrentTeleportRequest->doTeleport(); -#else - // Clear any current and failed teleports. - mCurrentTeleportRequest.reset(); - clearFailedTeleportRequest(); - - // Do not persist the teleport via lure request as it is only temporary and cannot be restarted - LLTeleportRequestPtr currentTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLure(lure_id, godlike)); - currentTeleportRequest->doTeleport(); -#endif + mCurrentTeleportRequest->startTeleport(); } void LLAgent::doTeleportViaLure(const LLUUID& lure_id, BOOL godlike) @@ -3785,7 +3782,7 @@ void LLAgent::teleportCancel() void LLAgent::teleportViaLocation(const LLVector3d& pos_global) { mCurrentTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLocation(pos_global)); - mCurrentTeleportRequest->doTeleport(); + mCurrentTeleportRequest->startTeleport(); } void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global) @@ -3833,7 +3830,7 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global) void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global) { mCurrentTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLocationLookAt(pos_global)); - mCurrentTeleportRequest->doTeleport(); + mCurrentTeleportRequest->startTeleport(); } void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global) @@ -4283,6 +4280,16 @@ LLTeleportRequest::~LLTeleportRequest() { } +bool LLTeleportRequest::canRestartTeleport() +{ + return false; +} + +void LLTeleportRequest::restartTeleport() +{ + llassert(0); +} + //----------------------------------------------------------------------------- // LLTeleportRequestViaLandmark //----------------------------------------------------------------------------- @@ -4297,7 +4304,17 @@ LLTeleportRequestViaLandmark::~LLTeleportRequestViaLandmark() { } -void LLTeleportRequestViaLandmark::doTeleport() +bool LLTeleportRequestViaLandmark::canRestartTeleport() +{ + return true; +} + +void LLTeleportRequestViaLandmark::startTeleport() +{ + gAgent.doTeleportViaLandmark(getLandmarkId()); +} + +void LLTeleportRequestViaLandmark::restartTeleport() { gAgent.doTeleportViaLandmark(getLandmarkId()); } @@ -4316,7 +4333,24 @@ LLTeleportRequestViaLure::~LLTeleportRequestViaLure() { } -void LLTeleportRequestViaLure::doTeleport() +bool LLTeleportRequestViaLure::canRestartTeleport() +{ + // stinson 05/17/2012 : cannot restart a teleport via lure because of server-side restrictions + // The current scenario is as follows: + // 1. User A initializes a request for User B to teleport via lure + // 2. User B accepts the teleport via lure request + // 3. The server sees the init request from User A and the accept request from User B and matches them up + // 4. The server then removes the paired requests up from the "queue" + // 5. The server then fails User B's teleport for reason of maturity level (for example) + // 6. User B's viewer prompts user to increase their maturity level profile value. + // 7. User B confirms and accepts increase in maturity level + // 8. User B's viewer then attempts to teleport via lure again + // 9. This request will time-out on the viewer-side because User A's initial request has been removed from the "queue" in step 4 + + return false; +} + +void LLTeleportRequestViaLure::startTeleport() { gAgent.doTeleportViaLure(getLandmarkId(), isLureGodLike()); } @@ -4335,7 +4369,17 @@ LLTeleportRequestViaLocation::~LLTeleportRequestViaLocation() { } -void LLTeleportRequestViaLocation::doTeleport() +bool LLTeleportRequestViaLocation::canRestartTeleport() +{ + return true; +} + +void LLTeleportRequestViaLocation::startTeleport() +{ + gAgent.doTeleportViaLocation(getPosGlobal()); +} + +void LLTeleportRequestViaLocation::restartTeleport() { gAgent.doTeleportViaLocation(getPosGlobal()); } @@ -4353,7 +4397,17 @@ LLTeleportRequestViaLocationLookAt::~LLTeleportRequestViaLocationLookAt() { } -void LLTeleportRequestViaLocationLookAt::doTeleport() +bool LLTeleportRequestViaLocationLookAt::canRestartTeleport() +{ + return true; +} + +void LLTeleportRequestViaLocationLookAt::startTeleport() +{ + gAgent.doTeleportViaLocationLookAt(getPosGlobal()); +} + +void LLTeleportRequestViaLocationLookAt::restartTeleport() { gAgent.doTeleportViaLocationLookAt(getPosGlobal()); } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index cbfe8af90c..6c1f4a76a1 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -578,6 +578,7 @@ protected: public: inline bool hasCurrentTeleportRequest() {return (mCurrentTeleportRequest != NULL);}; inline bool hasFailedTeleportRequest() {return (mFailedTeleportRequest != NULL);}; + bool hasRestartableFailedTeleportRequest(); void restartFailedTeleportRequest(); void clearFailedTeleportRequest(); void setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a2054c1244..f84ada18ab 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5387,7 +5387,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) } } -void handle_maturity_preference_change(const LLSD &pResponse, U8 pMaturityRatingChange) +void handle_maturity_preference_change_and_reteleport(const LLSD &pResponse, U8 pMaturityRatingChange) { bool isMaturityPreferenceElevated = false; U8 actualPrefValue = SIM_ACCESS_MIN; @@ -5485,7 +5485,7 @@ void handle_maturity_preference_change(const LLSD &pResponse, U8 pMaturityRating } } -bool handle_special_notification_callback(const LLSD& notification, const LLSD& response) +bool handle_prompt_for_maturity_level_change_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -5494,7 +5494,22 @@ bool handle_special_notification_callback(const LLSD& notification, const LLSD& // set the preference to the maturity of the region we're calling U8 preferredMaturity = static_cast<U8>(notification["payload"]["_region_access"].asInteger()); gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity)); - gAgent.sendMaturityPreferenceToServer(preferredMaturity, boost::bind(&handle_maturity_preference_change, _1, preferredMaturity)); + gAgent.sendMaturityPreferenceToServer(preferredMaturity); + } + + return false; +} + +bool handle_prompt_for_maturity_level_change_and_reteleport_callback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (0 == option) + { + // set the preference to the maturity of the region we're calling + U8 preferredMaturity = static_cast<U8>(notification["payload"]["_region_access"].asInteger()); + gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity)); + gAgent.sendMaturityPreferenceToServer(preferredMaturity, boost::bind(&handle_maturity_preference_change_and_reteleport, _1, preferredMaturity)); } else { @@ -5523,8 +5538,16 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock) } else if (gAgent.prefersPG()) { - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback); - returnValue = true; + if (gAgent.hasRestartableFailedTeleportRequest()) + { + maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback); + returnValue = true; + } + else + { + maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_ChangeOnly", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); + returnValue = true; + } } } else if (regionAccess == SIM_ACCESS_ADULT) @@ -5536,8 +5559,16 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock) } else if (gAgent.prefersPG() || gAgent.prefersMature()) { - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback); - returnValue = true; + if (gAgent.hasRestartableFailedTeleportRequest()) + { + maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback); + returnValue = true; + } + else + { + maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_ChangeOnly", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); + returnValue = true; + } } } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 0fe320f92b..cd28b5a770 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4107,7 +4107,7 @@ The region you're trying to visit contains [REGIONMATURITY] content, but your cu <notification icon="alertmodal.tga" - name="RegionEntryAccessBlocked_Change" + name="RegionEntryAccessBlocked_ChangeAndReTeleport" type="alertmodal"> <tag>fail</tag> <tag>confirm</tag> @@ -4128,6 +4128,27 @@ The region you're trying to visit contains [REGIONMATURITY] content, but your cu <notification icon="alertmodal.tga" + name="RegionEntryAccessBlocked_ChangeOnly" + type="alertmodal"> + <tag>fail</tag> + <tag>confirm</tag> +The region you're trying to visit contains [REGIONMATURITY] content, but your current preferences are set to exclude [REGIONMATURITY] content. We can change your preferences, or you can cancel the teleport. After your preferences are changed, you will need to attempt the teleport again. + <form name="form"> + <button + index="0" + name="OK" + text="Change preferences"/> + <button + default="true" + index="1" + name="Cancel" + text="Cancel"/> + <ignore name="ignore" text="My chosen Rating preference prevents me from entering a Region"/> + </form> + </notification> + + <notification + icon="alertmodal.tga" name="PreferredMaturityChanged" type="alertmodal"> You won't receive any more notifications that you're about to visit a region with [RATING] content. You may change your content preferences in the future by using Me > Preferences > General from the menu bar. @@ -4141,7 +4162,7 @@ You won't receive any more notifications that you're about to visit a region wit icon="alertmodal.tga" name="MaturityCouldNotBeChanged" type="alertmodal"> -We were unable to change your preferences to view [RATING] content at this time. Please attempt to change your preferences by using Me > Preferences > General from the menu bar, and then retrying your teleport. +We were unable to change your preferences to view [RATING] content at this time. Please change your preferences by using Me > Preferences > General from the menu bar, and then attempt your teleport again. <tag>confirm</tag> <usetemplate name="okbutton" |