From 42857fe4e9e898c8e350da2f9acb3b252b31694a Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 18 Mar 2008 05:44:25 +0000 Subject: * Added the ability to type the partial name of a region in the start location box and go to that region if it's there. If no close match was found, it sends you home. This is tested on mySQL. There's untested code on grids that are based on sqlite and MSSQL. The SQL statements *should* be right, but your results may very. * Ex, if you want to go to Wright Plaza, you simply need to type Wright Plaza in the start location in the client when you log-in. --- .../Region/Communications/OGS1/OGS1GridServices.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 05c2721..b7fae65 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -361,6 +361,59 @@ namespace OpenSim.Region.Communications.OGS1 return regionInfo; } + public RegionInfo RequestClosestRegion(string regionName) + { + // Don't use this method. It's only for SLURLS and Logins + RegionInfo regionInfo = null; + try + { + Hashtable requestData = new Hashtable(); + requestData["region_name_search"] = regionName; + requestData["authkey"] = serversInfo.GridSendKey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(requestData); + XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); + XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); + + Hashtable responseData = (Hashtable) GridResp.Value; + + if (responseData.ContainsKey("error")) + { + m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]); + return null; + } + + uint regX = Convert.ToUInt32((string) responseData["region_locx"]); + uint regY = Convert.ToUInt32((string) responseData["region_locy"]); + string internalIpStr = (string) responseData["sim_ip"]; + uint port = Convert.ToUInt32(responseData["sim_port"]); + string externalUri = (string) responseData["sim_uri"]; + + IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); + string neighbourExternalUri = externalUri; + regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); + + regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); + regionInfo.RemotingAddress = internalIpStr; + + regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); + regionInfo.RegionName = (string) responseData["region_name"]; + + m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); + } + catch (WebException) + { + m_log.Error("[OGS1 GRID SERVICES]: " + + "Region lookup failed for: " + regionName + + " - Is the GridServer down?"); + } + + + return regionInfo; + + } + + /// /// /// -- cgit v1.1