From cf14a6b4b5049c7b45f7de292fff28bcfd587060 Mon Sep 17 00:00:00 2001 From: Cinder <cinder@sdf.org> Date: Wed, 29 Jul 2015 12:00:30 -0600 Subject: [PATCH] Hg search url support --- indra/newview/llfloatersearch.cpp | 10 +++------- indra/newview/llpanelsearchweb.cpp | 11 +++-------- indra/newview/llviewerregion.cpp | 24 ++++++++++++++++++++++++ indra/newview/llviewerregion.h | 1 + 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index d6b64e2368..9ce67b5cd5 100755 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -198,13 +198,9 @@ void LLFloaterSearch::search(const SearchQuery &p) // get the search URL and expand all of the substitutions // (also adds things like [LANGUAGE], [VERSION], [OS], etc.) - std::string url; - if (LLLoginInstance::getInstance()->hasResponse("search")) - url = LLLoginInstance::getInstance()->getResponse("search").asString(); - else if (LLGridManager::getInstance()->isInOpenSim()) - url = gSavedSettings.getString("OpenSimSearchURL"); - else - url = gSavedSettings.getString("SearchURL"); + LLViewerRegion* regionp = gAgent.getRegion(); + std::string url = regionp != nullptr ? regionp->getSearchServerURL() + : gSavedSettings.getString(LLGridManager::getInstance()->isInOpenSim() ? "OpenSimSearchURL" : "SearchURL"): url = LLWeb::expandURLSubstitutions(url, subs); // and load the URL in the web view diff --git a/indra/newview/llpanelsearchweb.cpp b/indra/newview/llpanelsearchweb.cpp index 3654ea86f9..5e6ca2296a 100644 --- a/indra/newview/llpanelsearchweb.cpp +++ b/indra/newview/llpanelsearchweb.cpp @@ -131,15 +131,10 @@ void LLPanelSearchWeb::loadUrl(const SearchQuery &p) // Get the search URL and expand all of the substitutions // (also adds things like [LANGUAGE], [VERSION], [OS], etc.) - std::string url; - if (LLLoginInstance::getInstance()->hasResponse("search")) - url = LLLoginInstance::getInstance()->getResponse("search").asString(); - else if (LLGridManager::getInstance()->isInOpenSim()) - url = gSavedSettings.getString("OpenSimSearchURL"); - else - url = gSavedSettings.getString("SearchURL"); + LLViewerRegion* regionp = gAgent.getRegion(); + std::string url = regionp != nullptr ? regionp->getSearchServerURL() + : gSavedSettings.getString(LLGridManager::getInstance()->isInOpenSim() ? "OpenSimSearchURL" : "SearchURL"): url = LLWeb::expandURLSubstitutions(url, subs); - // Finally, load the URL in the webpanel mWebBrowser->navigateTo(url, "text/html"); } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7482c23b2f..58debfa394 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -57,6 +57,7 @@ #include "llfloaterreporter.h" #include "llfloaterregioninfo.h" #include "llhttpnode.h" +#include "lllogininstance.h" #include "llnotificationsutil.h" #include "llregioninfomodel.h" #include "llsdutil.h" @@ -80,6 +81,7 @@ #include "llfloaterperms.h" #include "llvieweroctree.h" #include "llviewerdisplay.h" +#include "llviewernetwork.h" #include "llviewerwindow.h" #include "llprogressview.h" @@ -3278,6 +3280,28 @@ std::string LLViewerRegion::getMapServerURL() const return url; } +std::string LLViewerRegion::getSearchServerURL() const +{ + std::string url; + // Check the region it trumps the grid + if (mSimulatorFeatures.has("OpenSimExtras") + && mSimulatorFeatures["OpenSimExtras"].has("search-server-url")) + { + url = mSimulatorFeatures["OpenSimExtras"]["search-server-url"].asString(); + } + // Check the login message + else if (LLLoginInstance::getInstance()->hasResponse("search")) + { + url = LLLoginInstance::getInstance()->getResponse("search").asString(); + } + // If all else fails, fall back to defaults + else + { + url = gSavedSettings.getString(LLGridManager::getInstance()->isInOpenSim() ? "OpenSimSearchURL" : "SearchURL"); + } + return url; +} + LLViewerTexture* LLViewerRegion::getMapImage() { if (mMapImage.isNull()) diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index a8a5a642c0..0a17aa1487 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -391,6 +391,7 @@ public: static BOOL isNewObjectCreationThrottleDisabled() {return sNewObjectCreationThrottle < 0;} std::string getMapServerURL() const; + std::string getSearchServerURL() const; LLViewerTexture* getMapImage(); // <alchemy/> private: -- GitLab