mirror of
https://github.com/OpenSim-NGC/OpenSim-Sasquatch.git
synced 2024-11-21 14:29:10 -07:00
add GetLocalRegionByName to GridServicesConnector plus cosmetics
This commit is contained in:
parent
fcddf631ce
commit
3823940205
5 changed files with 498 additions and 527 deletions
|
@ -71,7 +71,6 @@ namespace OpenSim.Region.ClientStack.LindenCaps
|
|||
lock (m_scenes)
|
||||
m_scenes.Remove(scene);
|
||||
scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
scene = null;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
@ -79,8 +78,7 @@ namespace OpenSim.Region.ClientStack.LindenCaps
|
|||
scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
|
||||
ISimulatorFeaturesModule simFeatures = scene.RequestModuleInterface<ISimulatorFeaturesModule>();
|
||||
if(simFeatures != null)
|
||||
simFeatures.AddFeature("AvatarHoverHeightEnabled",OSD.FromBoolean(true));
|
||||
simFeatures?.AddFeature("AvatarHoverHeightEnabled",OSD.FromBoolean(true));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -543,19 +543,21 @@ namespace OpenSim.Server.Base
|
|||
|
||||
public static Dictionary<string, object> ParseXmlResponse(string data)
|
||||
{
|
||||
try
|
||||
if(!string.IsNullOrEmpty(data))
|
||||
{
|
||||
using XmlReader xr = XmlReader.Create(new StringReader(data),
|
||||
ParseXmlStringResponseXmlReaderSettings, ParseXmlResponseXmlParserContext);
|
||||
if (!xr.ReadToFollowing("ServerResponse"))
|
||||
return new Dictionary<string, object>();
|
||||
return ScanXmlResponse(xr);
|
||||
try
|
||||
{
|
||||
using XmlReader xr = XmlReader.Create(new StringReader(data),
|
||||
ParseXmlStringResponseXmlReaderSettings, ParseXmlResponseXmlParserContext);
|
||||
if (xr.ReadToFollowing("ServerResponse"))
|
||||
return ScanXmlResponse(xr);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug($"[serverUtils.ParseXmlResponse]: failed error: {e.Message}\n --string:\n{data}\n");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0}\n --string:\n{1}\n", e.Message, data);
|
||||
}
|
||||
return new Dictionary<string, object>();
|
||||
return [];
|
||||
}
|
||||
|
||||
private static readonly XmlReaderSettings ParseXmlStreamResponseXmlReaderSettings = new()
|
||||
|
|
|
@ -102,6 +102,9 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
case "get_region_by_name":
|
||||
return GetRegionByName(request);
|
||||
|
||||
case "get_localregion_by_name":
|
||||
return GetLocalRegionByName(request);
|
||||
|
||||
case "get_regions_by_name":
|
||||
return GetRegionsByName(request);
|
||||
|
||||
|
@ -327,21 +330,40 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
byte[] GetRegionByName(Dictionary<string, object> request)
|
||||
{
|
||||
UUID scopeID = UUID.Zero;
|
||||
if (request.ContainsKey("SCOPEID"))
|
||||
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
|
||||
else
|
||||
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name");
|
||||
if (!request.TryGetValue("SCOPEID", out object scpo) || scpo is not string scps || !UUID.TryParse(scps, out scopeID))
|
||||
m_log.WarnFormat("[GRID HANDLER]: no or invalid scopeID in request to get region by name");
|
||||
|
||||
string regionName = string.Empty;
|
||||
if (request.ContainsKey("NAME"))
|
||||
regionName = request["NAME"].ToString();
|
||||
GridRegion rinfo = null;
|
||||
if (request.TryGetValue("NAME", out object nameo) && nameo is string regionName)
|
||||
rinfo = m_GridService.GetRegionByName(scopeID, regionName);
|
||||
else
|
||||
m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
|
||||
|
||||
GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName);
|
||||
//m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
|
||||
Dictionary<string, object> result = [];
|
||||
if (rinfo == null)
|
||||
result["result"] = "null";
|
||||
else
|
||||
result["result"] = rinfo.ToKeyValuePairs();
|
||||
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||
|
||||
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
|
||||
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
|
||||
}
|
||||
|
||||
byte[] GetLocalRegionByName(Dictionary<string, object> request)
|
||||
{
|
||||
UUID scopeID = UUID.Zero;
|
||||
if (!request.TryGetValue("SCOPEID", out object scpo) || scpo is not string scps || !UUID.TryParse(scps, out scopeID))
|
||||
m_log.WarnFormat("[GRID HANDLER]: no or invalid scopeID in request to get region by name");
|
||||
|
||||
GridRegion rinfo = null;
|
||||
if (request.TryGetValue("NAME", out object nameo) && nameo is string regionName)
|
||||
rinfo = m_GridService.GetLocalRegionByName(scopeID, regionName);
|
||||
else
|
||||
m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
|
||||
|
||||
Dictionary<string, object> result = [];
|
||||
if (rinfo == null)
|
||||
result["result"] = "null";
|
||||
else
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -44,9 +44,7 @@ namespace OpenSim.Services.GridService
|
|||
{
|
||||
public class GridService : GridServiceBase, IGridService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private string LogHeader = "[GRID SERVICE]";
|
||||
|
||||
private bool m_DeleteOnUnregister = true;
|
||||
|
@ -599,7 +597,7 @@ namespace OpenSim.Services.GridService
|
|||
if (!uri.ResolveDNS())
|
||||
return null;
|
||||
if(!m_HypergridLinker.IsLocalGrid(uri.HostUrl))
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (uri.HasRegionName)
|
||||
|
|
Loading…
Reference in a new issue