From 1dd32bb772bb2f0d6d4f3180965a8bdcf9c1000d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 2 Feb 2021 23:47:48 +0200 Subject: SL-14796 After teleporting, add notation into Nearby Chat --- indra/newview/llagent.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c65bc0fa50..f31135ad4c 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -519,6 +519,10 @@ void LLAgent::cleanup() { mTeleportFailedSlot.disconnect(); } + if (mParcelMgrConnection.connected()) + { + mParcelMgrConnection.disconnect(); + } } //----------------------------------------------------------------------------- @@ -3934,6 +3938,10 @@ void LLAgent::clearTeleportRequest() LLVoiceClient::getInstance()->setHidden(FALSE); } mTeleportRequest.reset(); + if (mParcelMgrConnection.connected()) + { + mParcelMgrConnection.disconnect(); + } } void LLAgent::setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange) @@ -3942,6 +3950,12 @@ void LLAgent::setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange) mMaturityRatingChange = pMaturityRatingChange; } +void LLAgent::sheduleTeleportIM() +{ + // is supposed to be called during teleport so we are still waiting for parcel + mParcelMgrConnection = addParcelChangedCallback(onParcelReadyAfterTeleport); +} + bool LLAgent::hasPendingTeleportRequest() { return ((mTeleportRequest != NULL) && @@ -4051,6 +4065,52 @@ void LLAgent::handleTeleportFailed() LLNotificationsUtil::add("PreferredMaturityChanged", args); mIsMaturityRatingChangingDuringTeleport = false; } + + if (mParcelMgrConnection.connected()) + { + mParcelMgrConnection.disconnect(); + } +} + +/*static*/ +void LLAgent::onParcelReadyAfterTeleport() +{ + LLViewerRegion* agent_region = gAgent.getRegion(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (!agent_region || !agent_parcel) + { + return; + } + + LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + if (nearby_chat) + { + std::string location_name; + LLAgentUI::ELocationFormat format = LLAgentUI::LOCATION_FORMAT_NO_MATURITY; + + // Might be better to provide slurl to chat + if (!LLAgentUI::buildLocationString(location_name, format)) + { + location_name = "Teleport to new region"; // Shouldn't happen + } + + LLChat chat; + chat.mFromName = location_name; + chat.mMuted = FALSE; + chat.mFromID = LLUUID::null; + chat.mSourceType = CHAT_SOURCE_TELEPORT; + chat.mChatStyle = CHAT_STYLE_TELEPORT_SEP; + chat.mText = ""; + + LLSD args; + args["do_not_log"] = TRUE; + nearby_chat->addMessage(chat, true, args); + } + + if (gAgent.mParcelMgrConnection.connected()) + { + gAgent.mParcelMgrConnection.disconnect(); + } } /*static*/ -- cgit v1.2.3 From ca6121979c6716aaf986fc6d0d469383471469f4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 4 Feb 2021 18:06:17 +0200 Subject: SL-14796 Updated code accordingly to changed event order --- indra/newview/llagent.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f31135ad4c..3c50493d79 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -387,6 +387,7 @@ LLAgent::LLAgent() : mTeleportFinishedSlot(), mTeleportFailedSlot(), mIsMaturityRatingChangingDuringTeleport(false), + mTPNeedsNeabyChatSeparator(false), mMaturityRatingChange(0U), mIsDoSendMaturityPreferenceToServer(false), mMaturityPreferenceRequestId(0U), @@ -519,10 +520,6 @@ void LLAgent::cleanup() { mTeleportFailedSlot.disconnect(); } - if (mParcelMgrConnection.connected()) - { - mParcelMgrConnection.disconnect(); - } } //----------------------------------------------------------------------------- @@ -3938,10 +3935,7 @@ void LLAgent::clearTeleportRequest() LLVoiceClient::getInstance()->setHidden(FALSE); } mTeleportRequest.reset(); - if (mParcelMgrConnection.connected()) - { - mParcelMgrConnection.disconnect(); - } + mTPNeedsNeabyChatSeparator = false; } void LLAgent::setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange) @@ -3953,7 +3947,7 @@ void LLAgent::setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange) void LLAgent::sheduleTeleportIM() { // is supposed to be called during teleport so we are still waiting for parcel - mParcelMgrConnection = addParcelChangedCallback(onParcelReadyAfterTeleport); + mTPNeedsNeabyChatSeparator = true; } bool LLAgent::hasPendingTeleportRequest() @@ -4003,6 +3997,12 @@ void LLAgent::startTeleportRequest() void LLAgent::handleTeleportFinished() { LL_INFOS("Teleport") << "Agent handling teleport finished." << LL_ENDL; + if (mTPNeedsNeabyChatSeparator) + { + // parcel is ready at this point + addTPNearbyChatSeparator(); + mTPNeedsNeabyChatSeparator = false; + } clearTeleportRequest(); mTeleportCanceled.reset(); if (mIsMaturityRatingChangingDuringTeleport) @@ -4066,14 +4066,11 @@ void LLAgent::handleTeleportFailed() mIsMaturityRatingChangingDuringTeleport = false; } - if (mParcelMgrConnection.connected()) - { - mParcelMgrConnection.disconnect(); - } + mTPNeedsNeabyChatSeparator = false; } /*static*/ -void LLAgent::onParcelReadyAfterTeleport() +void LLAgent::addTPNearbyChatSeparator() { LLViewerRegion* agent_region = gAgent.getRegion(); LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); @@ -4106,11 +4103,6 @@ void LLAgent::onParcelReadyAfterTeleport() args["do_not_log"] = TRUE; nearby_chat->addMessage(chat, true, args); } - - if (gAgent.mParcelMgrConnection.connected()) - { - gAgent.mParcelMgrConnection.disconnect(); - } } /*static*/ -- cgit v1.2.3