Converting WorldCommModule to INonSharedRegionModule

Signed-off-by: Diva Canto <diva@metaverseink.com>
integration
SignpostMarv 2012-11-11 00:21:10 +00:00 committed by Diva Canto
parent fe2fa70c74
commit a87c4c7d89
1 changed files with 26 additions and 12 deletions

View File

@ -30,6 +30,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Nini.Config; using Nini.Config;
using Mono.Addins;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -86,7 +87,8 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Scripting.WorldComm 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 = // private static readonly ILog m_log =
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -99,9 +101,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
private int m_saydistance = 20; private int m_saydistance = 20;
private int m_shoutdistance = 100; 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 // wrap this in a try block so that defaults will work if
// the config file doesn't specify otherwise. // the config file doesn't specify otherwise.
@ -120,12 +122,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
} }
if (maxlisteners < 1) maxlisteners = int.MaxValue; if (maxlisteners < 1) maxlisteners = int.MaxValue;
if (maxhandles < 1) maxhandles = int.MaxValue; if (maxhandles < 1) maxhandles = int.MaxValue;
m_scene = scene;
m_scene.RegisterModuleInterface<IWorldComm>(this);
m_listenerManager = new ListenerManager(maxlisteners, maxhandles); m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
m_scene.EventManager.OnChatFromClient += DeliverClientMessage;
m_scene.EventManager.OnChatBroadcast += DeliverClientMessage;
m_pendingQ = new Queue(); m_pendingQ = new Queue();
m_pending = Queue.Synchronized(m_pendingQ); m_pending = Queue.Synchronized(m_pendingQ);
} }
@ -134,6 +131,26 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
{ {
} }
public void AddRegion(Scene scene)
{
m_scene = scene;
m_scene.RegisterModuleInterface<IWorldComm>(this);
m_scene.EventManager.OnChatFromClient += DeliverClientMessage;
m_scene.EventManager.OnChatBroadcast += DeliverClientMessage;
}
public void RegionLoaded(Scene scene) { }
public void RemoveRegion(Scene scene)
{
if (scene != m_scene)
return;
m_scene.UnregisterModuleInterface<IWorldComm>(this);
m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage;
m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage;
}
public void Close() public void Close()
{ {
} }
@ -143,10 +160,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
get { return "WorldCommModule"; } get { return "WorldCommModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface { get { return null; } }
{
get { return false; }
}
#endregion #endregion