Another interregion comms change that will not work well with previous versions. This commit moves InformRegionOfChildAgent from OGS1 to RESTComms, effectively having the complete child agent life cycle over REST: create=POST, update=PUT, close=DELETE.

Additional changes include more functions in the IHyperlink interface, and some refactorings in the HG code for better reuse in RESTComms.
This commit is contained in:
diva
2009-01-03 07:05:33 +00:00
parent 1b7ce1c874
commit 158de95bde
10 changed files with 230 additions and 30 deletions

View File

@@ -890,17 +890,8 @@ namespace OpenSim.Region.Communications.Hypergrid
public virtual bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) { return false; }
public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
public bool SendUserInformation(RegionInfo regInfo, AgentCircuitData agentData)
{
// If we're here, it's because regionHandle is a remote, non-grided region
m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle);
RegionInfo regInfo = GetHyperlinkRegion(regionHandle);
if (regInfo == null)
return false;
//ulong realHandle = regionHandle;
CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
if ((uinfo == null) || !IsGoingHome(uinfo, regInfo))
{
@@ -914,6 +905,33 @@ namespace OpenSim.Region.Communications.Hypergrid
else
m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
// May need to change agent's name
if (IsLocalUser(uinfo))
{
agentData.firstname = agentData.firstname + "." + agentData.lastname;
agentData.lastname = "@" + serversInfo.UserURL.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
}
return true;
}
public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
// If we're here, it's because regionHandle is a remote, non-grided region
m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle);
RegionInfo regInfo = GetHyperlinkRegion(regionHandle);
if (regInfo == null)
return false;
//ulong realHandle = regionHandle;
if (!SendUserInformation(regInfo, agentData))
{
m_log.Warn("[HGrid]: Failed to inform remote region of user.");
//return false;
}
try
{
// ... and then
@@ -939,12 +957,14 @@ namespace OpenSim.Region.Communications.Hypergrid
if (remObject != null)
{
sAgentCircuitData sag = new sAgentCircuitData(agentData);
// May need to change agent's name
if (IsLocalUser(uinfo))
{
sag.firstname = agentData.firstname + "." + agentData.lastname;
sag.lastname = serversInfo.UserURL; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
}
//CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
//// May need to change agent's name
//if (IsLocalUser(uinfo))
//{
// sag.firstname = agentData.firstname + "." + agentData.lastname;
// sag.lastname = serversInfo.UserURL; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
//}
retValue = remObject.InformRegionOfChildAgent(regionHandle, sag);
}
else
@@ -1158,7 +1178,7 @@ namespace OpenSim.Region.Communications.Hypergrid
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
protected bool HGIncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
public void AdjustUserInformation(AgentCircuitData agentData)
{
CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
if ((uinfo != null) && (uinfo.UserProfile != null) &&
@@ -1174,7 +1194,6 @@ namespace OpenSim.Region.Communications.Hypergrid
}
//else
// Console.WriteLine("---------------> Foreign User!");
return true;
}
#endregion

View File

@@ -274,7 +274,7 @@ namespace OpenSim.Region.Communications.Hypergrid
/// <returns></returns>
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
HGIncomingChildAgent(regionHandle, agentData);
AdjustUserInformation(agentData);
m_log.Info("[HGrid]: Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname);

View File

@@ -764,7 +764,7 @@ namespace OpenSim.Region.Communications.Hypergrid
/// <returns></returns>
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
HGIncomingChildAgent(regionHandle, agentData);
AdjustUserInformation(agentData);
m_log.Info("[HGrid]: " + gdebugRegionName + ": Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname);