FIRE-15972: Recognize InWorldz IZURLs properly

meow-7.2.2
Ansariel 2016-06-28 19:32:10 +02:00
parent 88ff2c7a19
commit 3af46da957
6 changed files with 87 additions and 14 deletions

View File

@ -261,7 +261,7 @@ static BOOL isDefault(const std::string& scheme, U16 port)
void LLURI::parseAuthorityAndPathUsingOpaque()
{
if (mScheme == "http" || mScheme == "https" || mScheme == "hop" ||
if (mScheme == "http" || mScheme == "https" || mScheme == "hop" || mScheme == "inworldz" || mScheme == "iw" ||
mScheme == "ftp" || mScheme == "secondlife" ||
mScheme == "x-grid-location-info")
{

View File

@ -42,7 +42,7 @@
// <FS:AW> hop:// protocol>
//#define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))"
#define APP_HEADER_REGEX "(((hop|x-grid-location-info)://[-\\w\\.\\:\\@]+/app)|((hop|secondlife):///app))"
#define APP_HEADER_REGEX "(((hop|x-grid-location-info)://[-\\w\\.\\:\\@]+/app)|((hop|secondlife|inworldz|iw):///app))"
// </FS:AW>
// Utility functions
@ -340,7 +340,9 @@ std::string LLUrlEntryHTTPNoProtocol::getTooltip(const std::string &url) const
LLUrlEntryInvalidSLURL::LLUrlEntryInvalidSLURL()
: LLUrlEntryBase()
{
mPattern = boost::regex("(http://(maps.secondlife.com|slurl.com)/secondlife/|secondlife://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?",
// <FS:Ansariel> Inworldz special
//mPattern = boost::regex("(http://(maps.secondlife.com|slurl.com)/secondlife/|secondlife://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?",
mPattern = boost::regex("(http://(maps.secondlife.com|slurl.com)/secondlife/|(secondlife|inworldz|iw)://(/app/(worldmap|teleport)/)?)[^ /]+(/-?[0-9]+){1,3}(/?(\\?title|\\?img|\\?msg)=\\S*)?/?",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_http.xml";
mTooltip = LLTrans::getString("TooltipHttpUrl");
@ -1016,7 +1018,7 @@ LLUrlEntryObjectIM::LLUrlEntryObjectIM()
{
// <FS:AW> hop:// protocol; Ansa: Stop at first space so we can use it in notifications!
//mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\?.*",
mPattern = boost::regex("(hop|secondlife):///app/objectim/[\\da-f-]+\?[^ \t\r\n\v\f]*",
mPattern = boost::regex("(hop|secondlife|inworldz|iw):///app/objectim/[\\da-f-]+\?[^ \t\r\n\v\f]*",
// </FS:AW>
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_objectim.xml";
@ -1145,7 +1147,9 @@ void LLUrlEntryParcel::processParcelInfo(const LLParcelData& parcel_data)
//
LLUrlEntryPlace::LLUrlEntryPlace()
{
mPattern = boost::regex("((hop://[-\\w\\.\\:\\@]+/)|((x-grid-location-info://[-\\w\\.]+/region/)|(secondlife://)))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?", // <AW: hop:// protocol>
// <FS:Ansariel> Inworldz special
//mPattern = boost::regex("((hop://[-\\w\\.\\:\\@]+/)|((x-grid-location-info://[-\\w\\.]+/region/)|(secondlife://)))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?", // <AW: hop:// protocol>
mPattern = boost::regex("((hop://[-\\w\\.\\:\\@]+/)|((x-grid-location-info://[-\\w\\.]+/region/)|((secondlife|inworldz|iw)://)))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?", // <AW: hop:// protocol>
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_slurl.xml";
mTooltip = LLTrans::getString("TooltipSLURL");
@ -1327,7 +1331,7 @@ std::string LLUrlEntryTeleport::getLocation(const std::string &url) const
//
LLUrlEntrySL::LLUrlEntrySL()
{
mPattern = boost::regex("(hop|secondlife)://(\\w+)?(:\\d+)?/\\S+", // <AW: hop:// protocol>
mPattern = boost::regex("(hop|secondlife|inworldz|iw)://(\\w+)?(:\\d+)?/\\S+", // <AW: hop:// protocol>
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_slapp.xml";
mTooltip = LLTrans::getString("TooltipSLAPP");
@ -1344,7 +1348,7 @@ std::string LLUrlEntrySL::getLabel(const std::string &url, const LLUrlLabelCallb
//
LLUrlEntrySLLabel::LLUrlEntrySLLabel()
{
mPattern = boost::regex("\\[(hop|secondlife)://\\S+[ \t]+[^\\]]+\\]", // <AW: hop:// protocol>
mPattern = boost::regex("\\[(hop|secondlife|inworldz|iw)://\\S+[ \t]+[^\\]]+\\]", // <AW: hop:// protocol>
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_slapp.xml";
mTooltip = LLTrans::getString("TooltipSLAPP");

View File

@ -1432,6 +1432,10 @@ std::string LLGridManager::getAppSLURLBase(const std::string& grid)
{
ret = mGridList[grid][GRID_APP_SLURL_BASE].asString();
}
else if (grid == INWORLDZ_URI)
{
ret = "inworldz:///app";
}
else
{
std::string app_base;
@ -1463,6 +1467,6 @@ std::string LLGridManager::getAppSLURLBase(const std::string& grid)
ret = llformat(app_base.c_str(), grid_norm.c_str());
}
LL_DEBUGS("GridManager") << "App slurl base: " << ret << LL_ENDL;
LL_DEBUGS("GridManager") << "App slurl base: " << ret << " - grid = " << grid << LL_ENDL;
return ret;
}

View File

@ -70,6 +70,9 @@ const std::string GRID_SLURL_BASE = "slurl_base";
const std::string GRID_APP_SLURL_BASE = "app_slurl_base";
// </Opensim>
// Inworldz special
#define INWORLDZ_URI "inworldz.com:8002"
class GridInfoRequestResponder;
// <AW opensim>

View File

@ -52,14 +52,17 @@ const char* LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME = "x-grid-location-info";
const char* LLSLURL::WWW_SLURL_COM = "www.slurl.com";
const char* LLSLURL::MAPS_SECONDLIFE_COM = "maps.secondlife.com";
// <AW: opensim>
const char* LLSLURL::SLURL_COM = "slurl.com";
const char* LLSLURL::SLURL_APP_PATH = "app";
const char* LLSLURL::SLURL_SECONDLIFE_PATH = "secondlife";
const char* LLSLURL::SLURL_REGION_PATH = "region";
const char* LLSLURL::SIM_LOCATION_HOME = "home";
const char* LLSLURL::SIM_LOCATION_LAST = "last";
// </AW: opensim>
// Inworldz special
const char* LLSLURL::SLURL_INWORLDZ_SCHEME = "inworldz";
const char* LLSLURL::SLURL_IW_SCHEME = "iw";
const char* LLSLURL::PLACES_INWORLDZ_COM = "places.inworldz.com";
// resolve a simstring from a slurl
LLSLURL::LLSLURL(const std::string& slurl)
@ -212,7 +215,7 @@ LLSLURL::LLSLURL(const std::string& slurl)
if(mGrid.empty() && LLStartUp::getStartupState() == STATE_STARTED)
{
// we couldn't find the grid in the grid manager, so bail
LL_WARNS() << "unable to find grid" << LL_ENDL;
LL_WARNS("SLURL") << "unable to find grid" << LL_ENDL;
return;
}
// set the type as appropriate.
@ -241,6 +244,55 @@ LLSLURL::LLSLURL(const std::string& slurl)
path_array.insert(0, slurl_uri.hostNameAndPort());
}
}
else if (slurl_uri.scheme() == LLSLURL::SLURL_INWORLDZ_SCHEME ||
slurl_uri.scheme() == LLSLURL::SLURL_IW_SCHEME)
{
LL_DEBUGS("SLURL") << "inworldz scheme" << LL_ENDL;
mGrid = INWORLDZ_URI;
if (path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
{
// it's in the form iw://<grid>/(app)
// so parse the grid name to derive the grid ID
if (!slurl_uri.hostNameAndPort().empty())
{
LL_DEBUGS("SLURL") << "(inworldz|iw)://<grid>/app" << LL_ENDL;
mGrid = LLGridManager::getInstance()->getGridByProbing(slurl_uri.hostNameAndPort());
if (mGrid.empty())
{
mGrid = LLGridManager::getInstance()->getGridByProbing(slurl_uri.hostName());
}
}
else if (path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
{
LL_DEBUGS("SLURL") << "(inworldz|iw):///app" << LL_ENDL;
// for app style slurls, where no grid name is specified, assume the currently
// selected or logged in grid.
mGrid = LLGridManager::getInstance()->getGridId();
}
if (mGrid.empty() && LLStartUp::getStartupState() == STATE_STARTED)
{
// we couldn't find the grid in the grid manager, so bail
LL_WARNS("SLURL")<<"unable to find grid"<<LL_ENDL;
return;
}
mType = APP;
path_array.erase(0);
}
else
{
// it wasn't a /inworldz/<region> or /app/<params>, so it must be iw://<region>
// therefore the hostname will be the region name, and it's a location type
mType = LOCATION;
// 'normalize' it so the region name is in fact the head of the path_array
path_array.insert(0, slurl_uri.hostName());
}
}
else if((slurl_uri.scheme() == LLSLURL::SLURL_HTTP_SCHEME)
|| (slurl_uri.scheme() == LLSLURL::SLURL_HTTPS_SCHEME)
|| (slurl_uri.scheme() == LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME)
@ -257,6 +309,13 @@ LLSLURL::LLSLURL(const std::string& slurl)
else
mGrid = default_grid;
}
// places.inworldz.com isn't your regular everyday slurl
else if (slurl_uri.hostName() == LLSLURL::PLACES_INWORLDZ_COM)
{
// likewise, places.inworldz.com implies inworldz and a location
mGrid = INWORLDZ_URI;
mType = LOCATION;
}
else
{
LL_DEBUGS("SLURL") << "slurl style Standalone" << LL_ENDL;
@ -330,14 +389,12 @@ LLSLURL::LLSLURL(const std::string& slurl)
path_array.erase(0);
// leave app appended.
}
// <AW: hop:// protocol>
else if ( slurl_uri.scheme() == LLSLURL::HOP_SCHEME)
{
LL_DEBUGS("SLURL") << "It's a location hop" << LL_ENDL;
mType = LOCATION;
}
// </AW: hop:// protocol>
else
else if (slurl_uri.hostName() != LLSLURL::PLACES_INWORLDZ_COM)
{
LL_DEBUGS("SLURL") << "Not a valid https/http/x-grid-location-info slurl " << slurl << LL_ENDL;
// not a valid https/http/x-grid-location-info slurl, so it'll likely just be a URL

View File

@ -53,6 +53,11 @@ public:
static const char* SLURL_APP_PATH;
static const char* SLURL_REGION_PATH;
// Inworldz special
static const char* SLURL_INWORLDZ_SCHEME;
static const char* SLURL_IW_SCHEME;
static const char* PLACES_INWORLDZ_COM;
enum SLURL_TYPE
{
INVALID,