* Refactored UserLoginService.CustomiseResponse to be (almost) text-wide identical to LocalLoginService.CustomiseResponse in order to be able to pull them up.

0.6.3-post-fixes
lbsa71 2009-02-07 20:16:58 +00:00
parent 63fd4c0fb2
commit 262acf61c4
2 changed files with 67 additions and 20 deletions

View File

@ -183,12 +183,17 @@ namespace OpenSim.Grid.UserServer
// HomeLocation // HomeLocation
RegionProfileData homeInfo = null; RegionProfileData homeInfo = null;
// use the homeRegionID if it is stored already. If not, use the regionHandle as before // use the homeRegionID if it is stored already. If not, use the regionHandle as before
if (theUser.HomeRegionID != UUID.Zero) UUID homeRegionId = theUser.HomeRegionID;
homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegionID, ulong homeRegionHandle = theUser.HomeRegion;
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); if (homeRegionId != UUID.Zero)
{
homeInfo = GetRegionInfo(homeRegionId);
}
else else
homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegion, {
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); homeInfo = GetRegionInfo(homeRegionHandle);
}
if (homeInfo != null) if (homeInfo != null)
{ {
response.Home = response.Home =
@ -204,8 +209,8 @@ namespace OpenSim.Grid.UserServer
// Emergency mode: Home-region isn't available, so we can't request the region info. // Emergency mode: Home-region isn't available, so we can't request the region info.
// Use the stored home regionHandle instead. // Use the stored home regionHandle instead.
// NOTE: If the home-region moves, this will be wrong until the users update their user-profile again // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again
ulong regionX = theUser.HomeRegion >> 32; ulong regionX = homeRegionHandle >> 32;
ulong regionY = theUser.HomeRegion & 0xffffffff; ulong regionY = homeRegionHandle & 0xffffffff;
response.Home = response.Home =
string.Format( string.Format(
"{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
@ -227,8 +232,8 @@ namespace OpenSim.Grid.UserServer
} }
else if (startLocationRequest == "last") else if (startLocationRequest == "last")
{ {
regionInfo = RegionProfileData.RequestSimProfileData(theUser.CurrentAgent.Region, UUID lastRegion = theUser.CurrentAgent.Region;
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); regionInfo = GetRegionInfo(lastRegion);
response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
} }
else else
@ -242,8 +247,7 @@ namespace OpenSim.Grid.UserServer
else else
{ {
string region = uriMatch.Groups["region"].ToString(); string region = uriMatch.Groups["region"].ToString();
regionInfo = RegionProfileData.RequestSimProfileData(region, regionInfo = RequestClosestRegion(region);
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
if (regionInfo == null) if (regionInfo == null)
{ {
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
@ -280,7 +284,7 @@ namespace OpenSim.Grid.UserServer
} }
m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
regionInfo = RegionProfileData.RequestSimProfileData(defaultHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); regionInfo = GetRegionInfo(defaultHandle);
// Customise the response // Customise the response
//response.Home = //response.Home =
@ -296,6 +300,26 @@ namespace OpenSim.Grid.UserServer
return PrepareLoginToRegion(regionInfo, theUser, response); return PrepareLoginToRegion(regionInfo, theUser, response);
} }
protected RegionProfileData RequestClosestRegion(string region)
{
return RegionProfileData.RequestSimProfileData(region,
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
}
protected RegionProfileData GetRegionInfo(ulong homeRegionHandle)
{
return RegionProfileData.RequestSimProfileData(homeRegionHandle,
m_config.GridServerURL, m_config.GridSendKey,
m_config.GridRecvKey);
}
protected RegionProfileData GetRegionInfo(UUID homeRegionId)
{
return RegionProfileData.RequestSimProfileData(homeRegionId,
m_config.GridServerURL, m_config.GridSendKey,
m_config.GridRecvKey);
}
/// <summary> /// <summary>
/// Add active gestures of the user to the login response. /// Add active gestures of the user to the login response.
/// </summary> /// </summary>

View File

@ -145,10 +145,17 @@ namespace OpenSim.Region.Communications.Local
RegionInfo homeInfo = null; RegionInfo homeInfo = null;
// use the homeRegionID if it is stored already. If not, use the regionHandle as before // use the homeRegionID if it is stored already. If not, use the regionHandle as before
if (theUser.HomeRegionID != UUID.Zero) UUID homeRegionId = theUser.HomeRegionID;
homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegionID); ulong homeRegionHandle = theUser.HomeRegion;
if (homeRegionId != UUID.Zero)
{
homeInfo = GetRegionInfo(homeRegionId);
}
else else
homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegion); {
homeInfo = GetRegionInfo(homeRegionHandle);
}
if (homeInfo != null) if (homeInfo != null)
{ {
response.Home = response.Home =
@ -164,8 +171,8 @@ namespace OpenSim.Region.Communications.Local
// Emergency mode: Home-region isn't available, so we can't request the region info. // Emergency mode: Home-region isn't available, so we can't request the region info.
// Use the stored home regionHandle instead. // Use the stored home regionHandle instead.
// NOTE: If the home-region moves, this will be wrong until the users update their user-profile again // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again
ulong regionX = theUser.HomeRegion >> 32; ulong regionX = homeRegionHandle >> 32;
ulong regionY = theUser.HomeRegion & 0xffffffff; ulong regionY = homeRegionHandle & 0xffffffff;
response.Home = response.Home =
string.Format( string.Format(
"{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
@ -188,7 +195,8 @@ namespace OpenSim.Region.Communications.Local
} }
else if (startLocationRequest == "last") else if (startLocationRequest == "last")
{ {
regionInfo = m_gridService.RequestNeighbourInfo(theUser.CurrentAgent.Region); UUID lastRegion = theUser.CurrentAgent.Region;
regionInfo = GetRegionInfo(lastRegion);
response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
} }
else else
@ -202,7 +210,7 @@ namespace OpenSim.Region.Communications.Local
else else
{ {
string region = uriMatch.Groups["region"].ToString(); string region = uriMatch.Groups["region"].ToString();
regionInfo = m_gridService.RequestClosestRegion(region); regionInfo = RequestClosestRegion(region);
if (regionInfo == null) if (regionInfo == null)
{ {
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
@ -238,7 +246,7 @@ namespace OpenSim.Region.Communications.Local
} }
m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
regionInfo = m_gridService.RequestNeighbourInfo(defaultHandle); regionInfo = GetRegionInfo(defaultHandle);
// Customise the response // Customise the response
//response.Home = //response.Home =
@ -254,6 +262,21 @@ namespace OpenSim.Region.Communications.Local
return PrepareLoginToRegion(regionInfo, theUser, response); return PrepareLoginToRegion(regionInfo, theUser, response);
} }
protected RegionInfo RequestClosestRegion(string region)
{
return m_gridService.RequestClosestRegion(region);
}
protected RegionInfo GetRegionInfo(ulong homeRegionHandle)
{
return m_gridService.RequestNeighbourInfo(homeRegionHandle);
}
protected RegionInfo GetRegionInfo(UUID homeRegionId)
{
return m_gridService.RequestNeighbourInfo(homeRegionId);
}
/// <summary> /// <summary>
/// Add active gestures of the user to the login response. /// Add active gestures of the user to the login response.
/// </summary> /// </summary>