From 5af63a6a5c98fb153a07dcaac067ec3b94d6bdee Mon Sep 17 00:00:00 2001 From: diva Date: Mon, 23 Mar 2009 02:37:19 +0000 Subject: 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. --- .../Framework/Scenes/ChildAgentDataUpdate.cs | 25 ++++++++++++++++------ OpenSim/Region/Framework/Scenes/Scene.cs | 13 +++++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++++ 3 files changed, 39 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs index 17d3bb9..7e6e52a 100644 --- a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs +++ b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs @@ -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); } /// @@ -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! /// /// - 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); + } + } + } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9bec481..a60f7d8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -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); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3ef3f6c..d6607b3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -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 /// -- cgit v1.1