From 9e5b6368593419fa1ca12b209283f3233f877196 Mon Sep 17 00:00:00 2001 From: Cinders Date: Mon, 8 Apr 2013 16:50:29 -0600 Subject: [PATCH] FIRE-9687: Make slurls in chat work on hypergrid-enabled grids --- indra/newview/llurldispatcher.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index 709a3d6660..2233856bdf 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -210,6 +210,8 @@ bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string // LLURLDispatcherImpl::regionNameCallback, // slurl.getSLURLString(), LLSLURL hyper = slurl; + std::string region = hyper.getRegion(); + std::string dest = hyper.getSLURLString(); #ifdef OPENSIM // std::string grid = slurl.getGrid(); std::string current_grid = LLGridManager::getInstance()->getGrid(); @@ -219,7 +221,6 @@ bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string std::string current = LLGridManager::getInstance()->getGrid(); if((grid != current ) && (!LLGridManager::getInstance()->isInOpenSim() || (!slurl.getHypergrid() && gatekeeper.empty()))) { - std::string dest = hyper.getSLURLString(); if (!dest.empty()) { LLSD args; @@ -234,11 +235,28 @@ bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string { hyper = LLSLURL(gatekeeper + ":" + slurl.getRegion(), slurl.getPosition(), true); } + + // Trim the grid uri if we're talking a local region here. + if (grid == current) + { + std::size_t pos; + pos = region.find(current); + if (pos != std::string::npos) + { + region.erase(pos, pos + current.length() + 1); + } + + pos = dest.find(current); + if (pos != std::string::npos) + { + dest.erase(pos, pos + current.length() + 1); + } + } #endif //OPENSIM -// // Request a region handle by name - LLWorldMapMessage::getInstance()->sendNamedRegionRequest(hyper.getRegion(), LLURLDispatcherImpl::regionNameCallback, hyper.getSLURLString(), LLUI::sSettingGroups["config"]->getBOOL("SLURLTeleportDirectly")); // don't teleport + LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region, LLURLDispatcherImpl::regionNameCallback, dest, LLUI::sSettingGroups["config"]->getBOOL("SLURLTeleportDirectly")); // don't teleport +// return true; }