From a87c4c7d8924138896ab93828cd8e7d8442fbaf7 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 11 Nov 2012 00:21:10 +0000 Subject: Converting WorldCommModule to INonSharedRegionModule Signed-off-by: Diva Canto --- .../Scripting/WorldComm/WorldCommModule.cs | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 401ff6c..2c26e63 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -30,6 +30,7 @@ using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -86,7 +87,8 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.WorldComm { - public class WorldCommModule : IRegionModule, IWorldComm + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class WorldCommModule : IWorldComm, INonSharedRegionModule { // private static readonly ILog m_log = // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -99,9 +101,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm private int m_saydistance = 20; private int m_shoutdistance = 100; - #region IRegionModule Members + #region INonSharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { // wrap this in a try block so that defaults will work if // the config file doesn't specify otherwise. @@ -120,18 +122,33 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm } if (maxlisteners < 1) maxlisteners = int.MaxValue; if (maxhandles < 1) maxhandles = int.MaxValue; + m_listenerManager = new ListenerManager(maxlisteners, maxhandles); + m_pendingQ = new Queue(); + m_pending = Queue.Synchronized(m_pendingQ); + } + public void PostInitialise() + { + } + + public void AddRegion(Scene scene) + { m_scene = scene; m_scene.RegisterModuleInterface(this); - m_listenerManager = new ListenerManager(maxlisteners, maxhandles); m_scene.EventManager.OnChatFromClient += DeliverClientMessage; m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; - m_pendingQ = new Queue(); - m_pending = Queue.Synchronized(m_pendingQ); } - public void PostInitialise() + public void RegionLoaded(Scene scene) { } + + public void RemoveRegion(Scene scene) { + if (scene != m_scene) + return; + + m_scene.UnregisterModuleInterface(this); + m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage; + m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage; } public void Close() @@ -143,10 +160,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm get { return "WorldCommModule"; } } - public bool IsSharedModule - { - get { return false; } - } + public Type ReplaceableInterface { get { return null; } } #endregion -- cgit v1.1