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.
---
OpenSim/Grid/GridServer/GridManager.cs | 25 +++++++++++++++++++
OpenSim/Grid/UserServer/UserLoginService.cs | 38 +++++++++++++++++++++++++----
2 files changed, 58 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Grid')
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index e9ff91a..86fc445 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -164,6 +164,27 @@ namespace OpenSim.Grid.GridServer
return null;
}
+ ///
+ /// Returns a region by argument
+ ///
+ /// A partial regionName of the region to return
+ /// A SimProfileData for the region
+ public RegionProfileData getRegion(string regionName)
+ {
+ foreach (KeyValuePair kvp in _plugins)
+ {
+ try
+ {
+ return kvp.Value.GetProfileByString(regionName);
+ }
+ catch
+ {
+ m_log.Warn("[storage]: Unable to find region " + regionName + " via " + kvp.Key);
+ }
+ }
+ return null;
+ }
+
public Dictionary getRegions(uint xmin, uint ymin, uint xmax, uint ymax)
{
Dictionary regions = new Dictionary();
@@ -615,6 +636,10 @@ namespace OpenSim.Grid.GridServer
//CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
}
+ else if (requestData.ContainsKey("region_name_search"))
+ {
+ simData = getRegion((string)requestData["region_name_search"]);
+ }
if (simData == null)
{
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index b85ece9..6cc34d5 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -64,6 +64,8 @@ namespace OpenSim.Grid.UserServer
m_config = config;
}
+
+
///
/// Customises the login response and fills in missing values.
///
@@ -95,11 +97,34 @@ namespace OpenSim.Grid.UserServer
}
else
{
- // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
- SimInfo =
+ string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
+ m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
+ if (startLocationRequestParsed[0] == "last")
+ {
+ // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
+ SimInfo =
+ RegionProfileData.RequestSimProfileData(
+ theUser.currentAgent.currentHandle, m_config.GridServerURL,
+ m_config.GridSendKey, m_config.GridRecvKey);
+ }
+ else
+ {
+ m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
+ SimInfo =
RegionProfileData.RequestSimProfileData(
- theUser.currentAgent.currentHandle, m_config.GridServerURL,
+ startLocationRequestParsed[0], m_config.GridServerURL,
m_config.GridSendKey, m_config.GridRecvKey);
+
+ if (SimInfo == null)
+ {
+ m_log.Info("[LOGIN]: Didn't find region with a close name match sending to home location");
+ SimInfo =
+ RegionProfileData.RequestSimProfileData(
+ theUser.homeRegion, m_config.GridServerURL,
+ m_config.GridSendKey, m_config.GridRecvKey);
+ }
+
+ }
}
// Customise the response
@@ -132,6 +157,9 @@ namespace OpenSim.Grid.UserServer
//CFK: m_log.Info("[LOGIN]: " + SimInfo.regionName + " (" + SimInfo.serverURI + ") " +
//CFK: SimInfo.regionLocX + "," + SimInfo.regionLocY);
+ theUser.currentAgent.currentRegion = SimInfo.UUID;
+ theUser.currentAgent.currentHandle = SimInfo.regionHandle;
+
// Prepare notification
Hashtable SimParams = new Hashtable();
SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
@@ -149,8 +177,7 @@ namespace OpenSim.Grid.UserServer
SendParams.Add(SimParams);
// Update agent with target sim
- theUser.currentAgent.currentRegion = SimInfo.UUID;
- theUser.currentAgent.currentHandle = SimInfo.regionHandle;
+
m_log.Info("[LOGIN]: Telling "
+ SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " +
@@ -175,6 +202,7 @@ namespace OpenSim.Grid.UserServer
}
}
catch (Exception)
+ //catch (System.AccessViolationException)
{
tryDefault = true;
}
--
cgit v1.1