From a575bc38d61ac5cb74f60e0eee503ca7f3e99803 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 31 May 2007 14:22:14 +0000 Subject: More work on OpenGrid.Framework.Communications --- .../RegionServerCommsManager.cs | 2 +- .../TestLocalCommsManager.cs | 53 ++++++++++++++-------- Common/OpenSim.Framework/IRegionCommsHost.cs | 2 +- Common/OpenSim.Framework/OpenSim.Framework.csproj | 1 + Common/OpenSim.Framework/RegionCommsHostBase.cs | 32 +++++++++++++ 5 files changed, 68 insertions(+), 22 deletions(-) create mode 100644 Common/OpenSim.Framework/RegionCommsHostBase.cs (limited to 'Common') diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs index 9767185..2b8c5ca 100644 --- a/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs @@ -31,7 +31,7 @@ namespace OpenGrid.Framework.Communications /// /// /// - public virtual IRegionCommsHost RegisterRegion(RegionInfo regionInfo) + public virtual RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) { return null; } diff --git a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs index 32f4718..57049fc 100644 --- a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs @@ -12,6 +12,7 @@ namespace OpenGrid.Framework.Communications public class TestLocalCommsManager : RegionServerCommsManager { protected Dictionary regions = new Dictionary(); + protected Dictionary regionHosts = new Dictionary(); public TestLocalCommsManager() { @@ -21,19 +22,20 @@ namespace OpenGrid.Framework.Communications /// /// /// - /// - public override RegionInfo LoadRegionConfigFromGridServer(LLUUID regionID) - { - return null; - } - - /// - /// - /// /// /// - public override IRegionCommsHost RegisterRegion(RegionInfo regionInfo) + public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) { + if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) + { + this.regions.Add((uint)regionInfo.RegionHandle, regionInfo); + RegionCommsHostBase regionHost = new RegionCommsHostBase(); + this.regionHosts.Add((uint)regionInfo.RegionHandle, regionHost); + + return regionHost; + } + + //already in our list of regions so for now lets return null return null; } @@ -59,19 +61,30 @@ namespace OpenGrid.Framework.Communications /// /// /// + /// + /// /// - public override bool AvatarCrossingToRegion() + public bool AddNewSession(uint regionHandle, Login loginData) { - return false; - } + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = loginData.Agent; + agent.firstname = loginData.First; + agent.lastname = loginData.Last; + agent.SessionID = loginData.Session; + agent.SecureSessionID = loginData.SecureSession; + agent.circuitcode = loginData.CircuitCode; + agent.BaseFolder = loginData.BaseFolder; + agent.InventoryFolder = loginData.InventoryFolder; + agent.startpos = new LLVector3(128, 128, 70); - /// - /// - /// - /// - public override IList RequestMapBlocks() - { - return null; + if (this.regionHosts.ContainsKey((uint)regionHandle)) + { + this.regionHosts[(uint)regionHandle].TriggerExpectUser(agent); + return true; + } + + // region not found + return false; } } } diff --git a/Common/OpenSim.Framework/IRegionCommsHost.cs b/Common/OpenSim.Framework/IRegionCommsHost.cs index 815bd8e..d115bb7 100644 --- a/Common/OpenSim.Framework/IRegionCommsHost.cs +++ b/Common/OpenSim.Framework/IRegionCommsHost.cs @@ -6,7 +6,7 @@ using OpenSim.Framework.Types; namespace OpenSim.Framework { - public delegate void ExpectUserDelegate(); + public delegate void ExpectUserDelegate(AgentCircuitData agent); public delegate void UpdateNeighbours(List neighbours); public interface IRegionCommsHost diff --git a/Common/OpenSim.Framework/OpenSim.Framework.csproj b/Common/OpenSim.Framework/OpenSim.Framework.csproj index f83cb9d..be17a23 100644 --- a/Common/OpenSim.Framework/OpenSim.Framework.csproj +++ b/Common/OpenSim.Framework/OpenSim.Framework.csproj @@ -107,6 +107,7 @@ Code + Code diff --git a/Common/OpenSim.Framework/RegionCommsHostBase.cs b/Common/OpenSim.Framework/RegionCommsHostBase.cs new file mode 100644 index 0000000..782755e --- /dev/null +++ b/Common/OpenSim.Framework/RegionCommsHostBase.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenSim.Framework +{ + public class RegionCommsHostBase :IRegionCommsHost + { + public event ExpectUserDelegate OnExpectUser; + public event GenericCall2 OnExpectChildAgent; + public event GenericCall2 OnAvatarCrossingIntoRegion; + public event UpdateNeighbours OnNeighboursUpdate; + + /// + /// + /// + /// + /// + public virtual bool TriggerExpectUser(AgentCircuitData agent) + { + if(OnExpectUser != null) + { + OnExpectUser(agent); + return true; + } + + return false; + } + } +} -- cgit v1.1