From cce6f93dd7ffb1bcb40ea98d2ed63e0309085b53 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 15 Aug 2019 18:41:57 +0200 Subject: [PATCH] FIRE-12004: Add timer for refreshing attachments if attachments were attempted to get killed after the actual TP finished --- indra/newview/llviewermessage.cpp | 64 +++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e9f0afa7bc..776249a2ae 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -147,6 +147,7 @@ #include "fslightshare.h" // FIRE-5118 - Lightshare support #include "fslslbridge.h" #include "fsmoneytracker.h" +#include "llattachmentsmgr.h" #include "llfloaterbump.h" #include "llfloaterreg.h" #include "llfriendcard.h" @@ -185,6 +186,34 @@ const U8 AU_FLAGS_NONE = 0x00; const U8 AU_FLAGS_HIDETITLE = 0x01; const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02; +// Trigger refresh attachments if attachments get detached after TP finished +class FSHelloToKokuaRefreshAttachmentsTimer : public LLEventTimer +{ +public: + FSHelloToKokuaRefreshAttachmentsTimer() : LLEventTimer(5.f) + { + mEventTimer.stop(); + } + + BOOL tick() + { + if (gSavedSettings.getBOOL("FSExperimentalLostAttachmentsFixReport")) + { + report_to_nearby_chat("Refreshing attachments..."); + } + mEventTimer.stop(); + LLAttachmentsMgr::instance().refreshAttachments(); + return FALSE; + } + + void triggerRefresh() + { + mEventTimer.start(); + } +}; +FSHelloToKokuaRefreshAttachmentsTimer gFSRefreshAttachmentsTimer; +// + void accept_friendship_coro(std::string url, LLSD notification) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -4562,24 +4591,29 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) objectp->permYouOwner()) { // Simply ignore the request and don't kill the object - this should work... + + std::string reason; + if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) + { + reason = "tp"; + } + else if (gAgentAvatarp->isCrossingRegion()) + { + reason = "crossing"; + } + else + { + reason = "timer"; + gFSRefreshAttachmentsTimer.triggerRefresh(); + } + std::string message = "Region \"" + regionp->getName() + "\" tried to kill attachment: " + objectp->getAttachmentItemName() + " (" + reason + ") - Agent region: \"" + gAgent.getRegion()->getName() + "\""; + LL_WARNS("Messaging") << message << LL_ENDL; + if (gSavedSettings.getBOOL("FSExperimentalLostAttachmentsFixReport")) { - std::string reason; - if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) - { - reason = "tp"; - } - else if (gAgentAvatarp->isCrossingRegion()) - { - reason = "crossing"; - } - else - { - reason = "timer"; - } - - report_to_nearby_chat("Region \"" + regionp->getName() + "\" tried to kill attachment: " + objectp->getAttachmentItemName() + " (" + reason + ") - Agent region: \"" + gAgent.getRegion()->getName() + "\""); + report_to_nearby_chat(message); } + continue; } //