Make the estate communications handler selectable

Still defaults to the core EstateModule if not configured differently
melanie
Melanie Thielker 2017-01-05 18:05:06 +00:00
parent e0a6691932
commit de16ce35a3
1 changed files with 19 additions and 0 deletions

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
protected List<Scene> m_Scenes = new List<Scene>(); protected List<Scene> m_Scenes = new List<Scene>();
protected bool m_InInfoUpdate = false; protected bool m_InInfoUpdate = false;
private string token = "7db8eh2gvgg45jj"; private string token = "7db8eh2gvgg45jj";
protected bool m_enabled = false;
public bool InInfoUpdate public bool InInfoUpdate
{ {
@ -73,10 +74,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
IConfig estateConfig = config.Configs["Estates"]; IConfig estateConfig = config.Configs["Estates"];
if (estateConfig != null) if (estateConfig != null)
{ {
if (estateConfig.GetString("EstateCommunicationsHandler", Name) == Name)
m_enabled = true;
else
return;
port = (uint)estateConfig.GetInt("Port", 0); port = (uint)estateConfig.GetInt("Port", 0);
// this will need to came from somewhere else // this will need to came from somewhere else
token = estateConfig.GetString("Token", token); token = estateConfig.GetString("Token", token);
} }
else
{
m_enabled = true;
}
m_EstateConnector = new EstateConnector(this, token, port); m_EstateConnector = new EstateConnector(this, token, port);
@ -98,12 +108,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (!m_enabled)
return;
lock (m_Scenes) lock (m_Scenes)
m_Scenes.Add(scene); m_Scenes.Add(scene);
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
if (!m_enabled)
return;
IEstateModule em = scene.RequestModuleInterface<IEstateModule>(); IEstateModule em = scene.RequestModuleInterface<IEstateModule>();
em.OnRegionInfoChange += OnRegionInfoChange; em.OnRegionInfoChange += OnRegionInfoChange;
@ -115,6 +131,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
if (!m_enabled)
return;
lock (m_Scenes) lock (m_Scenes)
m_Scenes.Remove(scene); m_Scenes.Remove(scene);
} }