From b99e2cbbdd1e612e2fa0b71c3738154c548d5386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Wed, 8 Jan 2020 19:48:42 -0500 Subject: [PATCH] Add support for OBJECT type to get_slurl_for Caveat: Requires area search to be instantiated (should we break this out?) Only includes location if in object list --- indra/newview/llviewermenu.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4778b23cd..eb78f2e7c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -135,6 +135,7 @@ #include "llfloaternotificationsconsole.h" // +#include "jcfloaterareasearch.h" #include "lltexteditor.h" // Initialize the text editor menu listeners in here #include "llfloatermessagelog.h" #include "shfloatermediaticker.h" @@ -9047,6 +9048,27 @@ const std::string get_slurl_for(const LLUUID& id, const LFIDBearer::Type& type) { case LFIDBearer::GROUP: return LLGroupActions::getSLURL(id); case LFIDBearer::AVATAR: return LLAvatarActions::getSLURL(id); + case LFIDBearer::OBJECT: + { + auto areasearch = JCFloaterAreaSearch::findInstance(); + if (!areasearch) return LLStringUtil::null; + + const auto& obj_data = areasearch->getObjectData(id); + if (!obj_data) return LLStringUtil::null; + + LLSD sdQuery; + sdQuery["name"] = obj_data->name; + sdQuery["owner"] = obj_data->owner_id; + + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) && (obj_data->owner_id != gAgentID)) + sdQuery["rlv_shownames"] = true; + + if (const auto obj = gObjectList.findObject(id)) + if (const auto region = obj->getRegion()) + sdQuery["slurl"] = LLSLURL(region->getName(), obj->getPositionAgent()).getLocationString(); + + return LLSLURL("objectim", id, LLURI::mapToQueryString(sdQuery)).getSLURLString(); + } default: return LLStringUtil::null; } }