From a5ea09a4b5d53edef7a281ee610e921101db9b09 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 11 Aug 2010 05:57:33 -0700 Subject: Re-enabled search url fetching in the grid manager and fixed up web search to support them (fetched urls are equivalent to SearchURLDefault and searches follow the SL web search formatting) --- linden/indra/newview/hippoGridManager.cpp | 33 +++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'linden/indra/newview/hippoGridManager.cpp') diff --git a/linden/indra/newview/hippoGridManager.cpp b/linden/indra/newview/hippoGridManager.cpp index ccf63f5..5a229fd 100644 --- a/linden/indra/newview/hippoGridManager.cpp +++ b/linden/indra/newview/hippoGridManager.cpp @@ -314,6 +314,27 @@ std::string HippoGridInfo::getSearchUrl(SearchType ty, bool is_web) const return ""; } } + else if (!mSearchUrl.empty()) + { + // Search url sent to us in the login response + if (ty == SEARCH_ALL_EMPTY) + { + return (mSearchUrl); + } + else if (ty == SEARCH_ALL_QUERY) + { + return (mSearchUrl + "q=[QUERY]&s=[COLLECTION]&"); + } + else if (ty == SEARCH_ALL_TEMPLATE) + { + return "lang=[LANG]&mat=[MATURITY]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]"; + } + else + { + llinfos << "Illegal search URL type " << ty << llendl; + return ""; + } + } else { // OpenSim and other web search defaults @@ -349,7 +370,7 @@ std::string HippoGridInfo::getSearchUrl(SearchType ty, bool is_web) const } else if (ty == SEARCH_ALL_TEMPLATE) { - return "lang=[LANG]&m=[MATURE]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]"; + return "lang=[LANG]&m=[MATURITY]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]"; } else { @@ -384,8 +405,8 @@ void HippoGridInfo::onXmlElementStart(void* userData, const XML_Char* name, cons self->mXmlState = XML_REGISTER; else if (strcasecmp(name, "password") == 0) self->mXmlState = XML_PASSWORD; - //else if (strcasecmp(name, "search") == 0) - //self->mXmlState = XML_SEARCH; + else if (strcasecmp(name, "search") == 0) + self->mXmlState = XML_SEARCH; } //static @@ -431,7 +452,7 @@ void HippoGridInfo::onXmlCharacterData(void* userData, const XML_Char* s, int le case XML_SEARCH: { - //self->mSearchUrl.assign(s, len); + self->mSearchUrl.assign(s, len); //sanitizeQueryUrl(mSearchUrl); break; } @@ -888,7 +909,7 @@ void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) if (gridMap.has("support")) grid->setSupportUrl(gridMap["support"]); if (gridMap.has("register")) grid->setRegisterUrl(gridMap["register"]); if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]); - //if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); + if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); // if (gridMap.has("firstname")) grid->setFirstName(gridMap["firstname"]); // if (gridMap.has("lastname")) grid->setLastName(gridMap["lastname"]); @@ -928,7 +949,7 @@ void HippoGridManager::saveFile() // gridInfo[i]["lastname"] = grid->getLastName(); // gridInfo[i]["avatarpassword"] = grid->getAvatarPassword(); - //gridInfo[i]["search"] = grid->getSearchUrl(); + gridInfo[i]["search"] = grid->getSearchUrl(); gridInfo[i]["render_compat"] = grid->isRenderCompat(); } -- cgit v1.1