Root agent retrieval via http/REST. This is a pull, the caller gets the agent. This is not used by the regions yet, but it may be a better alternative to transfer agents even when that is done by the regions. The data is still trivial; soon it will have attachments, scripts and script state. Also, authorization tokens still to come. Serialization using OSD/json, as the other methods.

This commit is contained in:
diva
2009-03-23 02:37:19 +00:00
parent e1ea3f05aa
commit 5af63a6a5c
6 changed files with 209 additions and 35 deletions

View File

@@ -40,8 +40,8 @@ namespace OpenSim.Region.Framework.Scenes
{
UUID AgentID { get; set; }
OSDMap PackUpdateMessage();
void UnpackUpdateMessage(OSDMap map);
OSDMap Pack();
void Unpack(OSDMap map);
}
/// <summary>
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Framework.Scenes
public byte[] Throttles;
public OSDMap PackUpdateMessage()
public OSDMap Pack()
{
OSDMap args = new OSDMap();
args["message_type"] = OSD.FromString("AgentPosition");
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Scenes
return args;
}
public void UnpackUpdateMessage(OSDMap args)
public void Unpack(OSDMap args)
{
if (args.ContainsKey("region_handle"))
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
@@ -257,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes
public string CallbackURI;
public OSDMap PackUpdateMessage()
public virtual OSDMap Pack()
{
OSDMap args = new OSDMap();
args["message_type"] = OSD.FromString("AgentData");
@@ -346,7 +346,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Avoiding reflection makes it painful to write, but that's the price!
/// </summary>
/// <param name="hash"></param>
public void UnpackUpdateMessage(OSDMap args)
public virtual void Unpack(OSDMap args)
{
if (args.ContainsKey("region_handle"))
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
@@ -497,4 +497,17 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public class CompleteAgentData : AgentData
{
public override OSDMap Pack()
{
return base.Pack();
}
public override void Unpack(OSDMap map)
{
base.Unpack(map);
}
}
}

View File

@@ -2549,6 +2549,19 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent)
{
agent = null;
ScenePresence sp = GetScenePresence(id);
if ((sp != null) && (!sp.IsChildAgent))
{
sp.IsChildAgent = true;
return sp.CopyAgent(out agent);
}
return false;
}
public virtual bool IncomingReleaseAgent(UUID id)
{
return m_sceneGridService.ReleaseAgent(id);

View File

@@ -2879,6 +2879,13 @@ namespace OpenSim.Region.Framework.Scenes
}
public bool CopyAgent(out IAgentData agent)
{
agent = new CompleteAgentData();
CopyTo((AgentData)agent);
return true;
}
#endregion Child Agent Updates
/// <summary>