Merge branch 'master' of opensimulator.org:/var/git/opensim

melanie
UbitUmarov 2017-01-05 18:08:12 +00:00
commit a0c9f84994
3 changed files with 24 additions and 5 deletions

View File

@ -45,11 +45,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected XEstateModule m_EstateModule; protected EstateModule m_EstateModule;
private string token; private string token;
uint port = 0; uint port = 0;
public EstateConnector(XEstateModule module, string _token, uint _port) public EstateConnector(EstateModule module, string _token, uint _port)
{ {
m_EstateModule = module; m_EstateModule = module;
token = _token; token = _token;

View File

@ -45,13 +45,14 @@ using Mono.Addins;
namespace OpenSim.Region.CoreModules.World.Estate namespace OpenSim.Region.CoreModules.World.Estate
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XEstate")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XEstate")]
public class XEstateModule : ISharedRegionModule public class EstateModule : ISharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
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);
} }

View File

@ -46,11 +46,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected XEstateModule m_EstateModule; protected EstateModule m_EstateModule;
protected Object m_RequestLock = new Object(); protected Object m_RequestLock = new Object();
private string token; private string token;
public EstateRequestHandler(XEstateModule fmodule, string _token) public EstateRequestHandler(EstateModule fmodule, string _token)
: base("POST", "/estate") : base("POST", "/estate")
{ {
m_EstateModule = fmodule; m_EstateModule = fmodule;