Merge branch 'master' into httptests
commit
ebbb918404
|
@ -128,104 +128,104 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
m_Clients.Add(remoteClient.AgentId);
|
m_Clients.Add(remoteClient.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
OnMapNameRequest(remoteClient, mapName, flags);
|
||||||
{
|
|
||||||
OnMapNameRequest(remoteClient, mapName, flags);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
lock (m_Clients)
|
|
||||||
m_Clients.Remove(remoteClient.AgentId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
|
private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
|
||||||
{
|
{
|
||||||
Util.FireAndForget(x =>
|
Util.FireAndForget(x =>
|
||||||
{
|
{
|
||||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
try
|
||||||
if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
|
|
||||||
{
|
{
|
||||||
|
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||||
|
if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
|
||||||
|
{
|
||||||
|
// final block, closing the search result
|
||||||
|
AddFinalBlock(blocks,mapName);
|
||||||
|
|
||||||
|
// flags are agent flags sent from the viewer.
|
||||||
|
// they have different values depending on different viewers, apparently
|
||||||
|
remoteClient.SendMapBlock(blocks, flags);
|
||||||
|
remoteClient.SendAlertMessage("Use a search string with at least 3 characters");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//m_log.DebugFormat("MAP NAME=({0})", mapName);
|
||||||
|
|
||||||
|
// Hack to get around the fact that ll V3 now drops the port from the
|
||||||
|
// map name. See https://jira.secondlife.com/browse/VWR-28570
|
||||||
|
//
|
||||||
|
// Caller, use this magic form instead:
|
||||||
|
// secondlife://http|!!mygrid.com|8002|Region+Name/128/128
|
||||||
|
// or url encode if possible.
|
||||||
|
// the hacks we do with this viewer...
|
||||||
|
//
|
||||||
|
bool needOriginalName = false;
|
||||||
|
string mapNameOrig = mapName;
|
||||||
|
if (mapName.Contains("|"))
|
||||||
|
{
|
||||||
|
mapName = mapName.Replace('|', ':');
|
||||||
|
needOriginalName = true;
|
||||||
|
}
|
||||||
|
if (mapName.Contains("+"))
|
||||||
|
{
|
||||||
|
mapName = mapName.Replace('+', ' ');
|
||||||
|
needOriginalName = true;
|
||||||
|
}
|
||||||
|
if (mapName.Contains("!"))
|
||||||
|
{
|
||||||
|
mapName = mapName.Replace('!', '/');
|
||||||
|
needOriginalName = true;
|
||||||
|
}
|
||||||
|
if (mapName.Contains("."))
|
||||||
|
needOriginalName = true;
|
||||||
|
|
||||||
|
// try to fetch from GridServer
|
||||||
|
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
|
||||||
|
// if (regionInfos.Count == 0)
|
||||||
|
// remoteClient.SendAlertMessage("Hyperlink could not be established.");
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
|
||||||
|
|
||||||
|
MapBlockData data;
|
||||||
|
if (regionInfos.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (GridRegion info in regionInfos)
|
||||||
|
{
|
||||||
|
data = new MapBlockData();
|
||||||
|
data.Agents = 0;
|
||||||
|
data.Access = info.Access;
|
||||||
|
MapBlockData block = new MapBlockData();
|
||||||
|
WorldMap.MapBlockFromGridRegion(block, info, flags);
|
||||||
|
|
||||||
|
if (flags == 2 && regionInfos.Count == 1 && needOriginalName)
|
||||||
|
block.Name = mapNameOrig;
|
||||||
|
blocks.Add(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// final block, closing the search result
|
// final block, closing the search result
|
||||||
AddFinalBlock(blocks,mapName);
|
AddFinalBlock(blocks,mapNameOrig);
|
||||||
|
|
||||||
// flags are agent flags sent from the viewer.
|
// flags are agent flags sent from the viewer.
|
||||||
// they have different values depending on different viewers, apparently
|
// they have different values depending on different viewers, apparently
|
||||||
remoteClient.SendMapBlock(blocks, flags);
|
remoteClient.SendMapBlock(blocks, flags);
|
||||||
remoteClient.SendAlertMessage("Use a search string with at least 3 characters");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//m_log.DebugFormat("MAP NAME=({0})", mapName);
|
// send extra user messages for V3
|
||||||
|
// because the UI is very confusing
|
||||||
// Hack to get around the fact that ll V3 now drops the port from the
|
// while we don't fix the hard-coded urls
|
||||||
// map name. See https://jira.secondlife.com/browse/VWR-28570
|
if (flags == 2)
|
||||||
//
|
|
||||||
// Caller, use this magic form instead:
|
|
||||||
// secondlife://http|!!mygrid.com|8002|Region+Name/128/128
|
|
||||||
// or url encode if possible.
|
|
||||||
// the hacks we do with this viewer...
|
|
||||||
//
|
|
||||||
bool needOriginalName = false;
|
|
||||||
string mapNameOrig = mapName;
|
|
||||||
if (mapName.Contains("|"))
|
|
||||||
{
|
|
||||||
mapName = mapName.Replace('|', ':');
|
|
||||||
needOriginalName = true;
|
|
||||||
}
|
|
||||||
if (mapName.Contains("+"))
|
|
||||||
{
|
|
||||||
mapName = mapName.Replace('+', ' ');
|
|
||||||
needOriginalName = true;
|
|
||||||
}
|
|
||||||
if (mapName.Contains("!"))
|
|
||||||
{
|
|
||||||
mapName = mapName.Replace('!', '/');
|
|
||||||
needOriginalName = true;
|
|
||||||
}
|
|
||||||
if (mapName.Contains("."))
|
|
||||||
needOriginalName = true;
|
|
||||||
|
|
||||||
// try to fetch from GridServer
|
|
||||||
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
|
|
||||||
// if (regionInfos.Count == 0)
|
|
||||||
// remoteClient.SendAlertMessage("Hyperlink could not be established.");
|
|
||||||
|
|
||||||
//m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
|
|
||||||
|
|
||||||
MapBlockData data;
|
|
||||||
if (regionInfos.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (GridRegion info in regionInfos)
|
|
||||||
{
|
{
|
||||||
data = new MapBlockData();
|
if (regionInfos.Count == 0)
|
||||||
data.Agents = 0;
|
remoteClient.SendAgentAlertMessage("No regions found with that name.", true);
|
||||||
data.Access = info.Access;
|
// else if (regionInfos.Count == 1)
|
||||||
MapBlockData block = new MapBlockData();
|
// remoteClient.SendAgentAlertMessage("Region found!", false);
|
||||||
WorldMap.MapBlockFromGridRegion(block, info, flags);
|
|
||||||
|
|
||||||
if (flags == 2 && regionInfos.Count == 1 && needOriginalName)
|
|
||||||
block.Name = mapNameOrig;
|
|
||||||
blocks.Add(block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
// final block, closing the search result
|
|
||||||
AddFinalBlock(blocks,mapNameOrig);
|
|
||||||
|
|
||||||
// flags are agent flags sent from the viewer.
|
|
||||||
// they have different values depending on different viewers, apparently
|
|
||||||
remoteClient.SendMapBlock(blocks, flags);
|
|
||||||
|
|
||||||
// send extra user messages for V3
|
|
||||||
// because the UI is very confusing
|
|
||||||
// while we don't fix the hard-coded urls
|
|
||||||
if (flags == 2)
|
|
||||||
{
|
{
|
||||||
if (regionInfos.Count == 0)
|
lock (m_Clients)
|
||||||
remoteClient.SendAgentAlertMessage("No regions found with that name.", true);
|
m_Clients.Remove(remoteClient.AgentId);
|
||||||
// else if (regionInfos.Count == 1)
|
|
||||||
// remoteClient.SendAgentAlertMessage("Region found!", false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -13758,6 +13758,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
|
case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
|
||||||
ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY));
|
ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY));
|
||||||
break;
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_CLICK_ACTION:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_OMEGA:
|
||||||
|
ret.Add(new LSL_Vector(Vector3.Zero));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PRIM_COUNT:
|
||||||
|
List<SceneObjectGroup> Attachments = av.GetAttachments();
|
||||||
|
int count = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (SceneObjectGroup Attachment in Attachments)
|
||||||
|
count += Attachment.PrimCount;
|
||||||
|
} catch { };
|
||||||
|
ret.Add(new LSL_Integer(count));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
|
||||||
|
List<SceneObjectGroup> invAttachments = av.GetAttachments();
|
||||||
|
int invcount = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (SceneObjectGroup Attachment in invAttachments)
|
||||||
|
{
|
||||||
|
SceneObjectPart[] parts = Attachment.Parts;
|
||||||
|
int nparts = parts.Count();
|
||||||
|
for(int i = 0; i < nparts; i++)
|
||||||
|
invcount += parts[i].Inventory.Count;
|
||||||
|
}
|
||||||
|
} catch { };
|
||||||
|
ret.Add(new LSL_Integer(invcount));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_GROUP_TAG:
|
||||||
|
ret.Add(new LSL_String(av.Grouptitle));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Invalid or unhandled constant.
|
// Invalid or unhandled constant.
|
||||||
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||||
|
@ -13930,6 +13964,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
|
case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
|
||||||
ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString()));
|
ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString()));
|
||||||
break;
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_CLICK_ACTION:
|
||||||
|
ret.Add(new LSL_Integer(obj.ClickAction));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_OMEGA:
|
||||||
|
ret.Add(new LSL_Vector(obj.AngularVelocity));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PRIM_COUNT:
|
||||||
|
ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TOTAL_INVENTORY_COUNT:
|
||||||
|
SceneObjectPart[] parts = obj.ParentGroup.Parts;
|
||||||
|
int nparts = parts.Count();
|
||||||
|
int count = 0;
|
||||||
|
for(int i = 0; i < nparts; i++)
|
||||||
|
count += parts[i].Inventory.Count;
|
||||||
|
ret.Add(new LSL_Integer(count));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_GROUP_TAG:
|
||||||
|
ret.Add(new LSL_String(String.Empty));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Invalid or unhandled constant.
|
// Invalid or unhandled constant.
|
||||||
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||||
|
|
|
@ -636,6 +636,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int OBJECT_HOVER_HEIGHT = 25;
|
public const int OBJECT_HOVER_HEIGHT = 25;
|
||||||
public const int OBJECT_BODY_SHAPE_TYPE = 26;
|
public const int OBJECT_BODY_SHAPE_TYPE = 26;
|
||||||
public const int OBJECT_LAST_OWNER_ID = 27;
|
public const int OBJECT_LAST_OWNER_ID = 27;
|
||||||
|
public const int OBJECT_CLICK_ACTION = 28;
|
||||||
|
public const int OBJECT_OMEGA = 29;
|
||||||
|
public const int OBJECT_PRIM_COUNT = 30;
|
||||||
|
public const int OBJECT_TOTAL_INVENTORY_COUNT = 31;
|
||||||
|
public const int OBJECT_GROUP_TAG = 33;
|
||||||
|
|
||||||
// Pathfinding types
|
// Pathfinding types
|
||||||
public const int OPT_OTHER = -1;
|
public const int OPT_OTHER = -1;
|
||||||
|
|
|
@ -579,7 +579,70 @@ namespace OpenSim.Services.GridService
|
||||||
int count = 0;
|
int count = 0;
|
||||||
List<GridRegion> rinfos = new List<GridRegion>();
|
List<GridRegion> rinfos = new List<GridRegion>();
|
||||||
|
|
||||||
if (rdatas != null)
|
if (count < maxNumber && m_AllowHypergridMapSearch && name.Contains("."))
|
||||||
|
{
|
||||||
|
string regionURI = "";
|
||||||
|
string regionName = "";
|
||||||
|
if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
string mapname = regionURI + regionName;
|
||||||
|
bool haveMatch = false;
|
||||||
|
|
||||||
|
if (rdatas != null && (rdatas.Count > 0))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
|
||||||
|
foreach (RegionData rdata in rdatas)
|
||||||
|
{
|
||||||
|
if (count++ < maxNumber)
|
||||||
|
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||||
|
if(rdata.RegionName == mapname)
|
||||||
|
{
|
||||||
|
haveMatch = true;
|
||||||
|
if(count == maxNumber)
|
||||||
|
{
|
||||||
|
rinfos.RemoveAt(count - 1);
|
||||||
|
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(haveMatch)
|
||||||
|
return rinfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
rdatas = m_Database.Get(Util.EscapeForLike(mapname)+ "%", scopeID);
|
||||||
|
if (rdatas != null && (rdatas.Count > 0))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
|
||||||
|
foreach (RegionData rdata in rdatas)
|
||||||
|
{
|
||||||
|
if (count++ < maxNumber)
|
||||||
|
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||||
|
if(rdata.RegionName == mapname)
|
||||||
|
{
|
||||||
|
haveMatch = true;
|
||||||
|
if(count == maxNumber)
|
||||||
|
{
|
||||||
|
rinfos.RemoveAt(count - 1);
|
||||||
|
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(haveMatch)
|
||||||
|
return rinfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
string HGname = regionURI +" "+ regionName;
|
||||||
|
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
|
||||||
|
if (r != null)
|
||||||
|
{
|
||||||
|
if( count == maxNumber)
|
||||||
|
rinfos.RemoveAt(count - 1);
|
||||||
|
rinfos.Add(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (rdatas != null && (rdatas.Count > 0))
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
|
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
|
||||||
foreach (RegionData rdata in rdatas)
|
foreach (RegionData rdata in rdatas)
|
||||||
|
@ -589,13 +652,6 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)))
|
|
||||||
{
|
|
||||||
GridRegion r = GetHypergridRegionByName(scopeID, name);
|
|
||||||
if (r != null)
|
|
||||||
rinfos.Add(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rinfos;
|
return rinfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,7 +664,20 @@ namespace OpenSim.Services.GridService
|
||||||
protected GridRegion GetHypergridRegionByName(UUID scopeID, string name)
|
protected GridRegion GetHypergridRegionByName(UUID scopeID, string name)
|
||||||
{
|
{
|
||||||
if (name.Contains("."))
|
if (name.Contains("."))
|
||||||
return m_HypergridLinker.LinkRegion(scopeID, name);
|
{
|
||||||
|
string regionURI = "";
|
||||||
|
string regionName = "";
|
||||||
|
if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
string mapname = regionURI + regionName;
|
||||||
|
List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(mapname), scopeID);
|
||||||
|
if ((rdatas != null) && (rdatas.Count > 0))
|
||||||
|
return RegionData2RegionInfo(rdatas[0]); // get the first
|
||||||
|
|
||||||
|
string HGname = regionURI +" "+ regionName;
|
||||||
|
return m_HypergridLinker.LinkRegion(scopeID, HGname);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,14 +191,14 @@ namespace OpenSim.Services.GridService
|
||||||
return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
|
return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
|
public bool buildHGRegionURI(string inputName, out string serverURI, out string regionName)
|
||||||
{
|
{
|
||||||
reason = string.Empty;
|
serverURI = string.Empty;
|
||||||
GridRegion regInfo = null;
|
regionName = string.Empty;
|
||||||
|
|
||||||
mapName = mapName.Trim();
|
inputName = inputName.Trim();
|
||||||
|
|
||||||
if (!mapName.StartsWith("http") && !mapName.StartsWith("https"))
|
if (!inputName.StartsWith("http") && !inputName.StartsWith("https"))
|
||||||
{
|
{
|
||||||
// Formats: grid.example.com:8002:region name
|
// Formats: grid.example.com:8002:region name
|
||||||
// grid.example.com:region name
|
// grid.example.com:region name
|
||||||
|
@ -207,38 +207,59 @@ namespace OpenSim.Services.GridService
|
||||||
|
|
||||||
string host;
|
string host;
|
||||||
uint port = 80;
|
uint port = 80;
|
||||||
string regionName = "";
|
|
||||||
|
|
||||||
string[] parts = mapName.Split(new char[] { ':' });
|
string[] parts = inputName.Split(new char[] { ':' });
|
||||||
|
int indx;
|
||||||
if (parts.Length == 0)
|
if(parts.Length == 0)
|
||||||
|
return false;
|
||||||
|
if (parts.Length == 1)
|
||||||
{
|
{
|
||||||
reason = "Wrong format for link-region";
|
indx = inputName.IndexOf('/');
|
||||||
return null;
|
if (indx < 0)
|
||||||
|
serverURI = "http://"+ inputName + "/";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serverURI = "http://"+ inputName.Substring(0,indx + 1);
|
||||||
|
if(indx + 2 < inputName.Length)
|
||||||
|
regionName = inputName.Substring(indx + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
host = parts[0];
|
|
||||||
|
|
||||||
if (parts.Length >= 2)
|
|
||||||
{
|
{
|
||||||
// If it's a number then assume it's a port. Otherwise, it's a region name.
|
host = parts[0];
|
||||||
if (!UInt32.TryParse(parts[1], out port))
|
|
||||||
regionName = parts[1];
|
if (parts.Length >= 2)
|
||||||
}
|
{
|
||||||
|
indx = parts[1].IndexOf('/');
|
||||||
|
if(indx < 0)
|
||||||
|
{
|
||||||
|
// If it's a number then assume it's a port. Otherwise, it's a region name.
|
||||||
|
if (!UInt32.TryParse(parts[1], out port))
|
||||||
|
{
|
||||||
|
port = 80;
|
||||||
|
regionName = parts[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string portstr = parts[1].Substring(0, indx);
|
||||||
|
if(indx + 2 < parts[1].Length)
|
||||||
|
regionName = parts[1].Substring(indx + 1);
|
||||||
|
if (!UInt32.TryParse(portstr, out port))
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// always take the last one
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
|
regionName = parts[2];
|
||||||
|
}
|
||||||
|
|
||||||
// always take the last one
|
if(port == 80)
|
||||||
if (parts.Length >= 3)
|
serverURI = "http://"+ host + "/";
|
||||||
{
|
else
|
||||||
regionName = parts[2];
|
serverURI = "http://"+ host +":"+ port.ToString() + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
string serverURI = "http://"+ host +":"+ port.ToString() + "/";
|
|
||||||
// bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
|
|
||||||
if(TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, serverURI, ownerID, out regInfo, out reason))
|
|
||||||
{
|
|
||||||
regInfo.RegionName = mapName;
|
|
||||||
return regInfo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -246,32 +267,61 @@ namespace OpenSim.Services.GridService
|
||||||
// http://grid.example.com "region name"
|
// http://grid.example.com "region name"
|
||||||
// http://grid.example.com
|
// http://grid.example.com
|
||||||
|
|
||||||
string serverURI;
|
string[] parts = inputName.Split(new char[] { ' ' });
|
||||||
string regionName = "";
|
|
||||||
|
|
||||||
string[] parts = mapName.Split(new char[] { ' ' });
|
|
||||||
|
|
||||||
if (parts.Length == 0)
|
if (parts.Length == 0)
|
||||||
{
|
return false;
|
||||||
reason = "Wrong format for link-region";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
serverURI = parts[0];
|
serverURI = parts[0];
|
||||||
if (!serverURI.EndsWith("/"))
|
|
||||||
serverURI = serverURI + "/";
|
|
||||||
|
|
||||||
if (parts.Length >= 2)
|
int indx = serverURI.LastIndexOf('/');
|
||||||
|
if(indx > 10)
|
||||||
{
|
{
|
||||||
regionName = mapName.Substring(serverURI.Length);
|
if(indx + 2 < inputName.Length)
|
||||||
regionName = regionName.Trim(new char[] { '"', ' ' });
|
regionName = inputName.Substring(indx + 1);
|
||||||
|
serverURI = inputName.Substring(0, indx + 1);
|
||||||
}
|
}
|
||||||
|
else if (parts.Length >= 2)
|
||||||
|
{
|
||||||
|
regionName = inputName.Substring(serverURI.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, serverURI, ownerID, out regInfo, out reason))
|
// use better code for sanity check
|
||||||
{
|
Uri uri;
|
||||||
regInfo.RegionName = mapName;
|
try
|
||||||
return regInfo;
|
{
|
||||||
}
|
uri = new Uri(serverURI);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(regionName))
|
||||||
|
regionName = regionName.Trim(new char[] { '"', ' ' });
|
||||||
|
serverURI = uri.AbsoluteUri;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
|
||||||
|
{
|
||||||
|
reason = string.Empty;
|
||||||
|
GridRegion regInfo = null;
|
||||||
|
|
||||||
|
string serverURI = string.Empty;
|
||||||
|
string regionName = string.Empty;
|
||||||
|
|
||||||
|
if(!buildHGRegionURI(mapName, out serverURI, out regionName))
|
||||||
|
{
|
||||||
|
reason = "Wrong URI format for link-region";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, serverURI, ownerID, out regInfo, out reason))
|
||||||
|
{
|
||||||
|
regInfo.RegionName = serverURI + regionName;
|
||||||
|
return regInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue