Updates all IRegionModules to the new style region modules.

Signed-off-by: Melanie <melanie@t-data.com>
This commit is contained in:
Revolution
2010-01-22 18:09:33 -06:00
committed by Melanie
parent e61f42ad3a
commit ec3c31e61e
76 changed files with 1899 additions and 954 deletions

View File

@@ -35,6 +35,7 @@ using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Web;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@@ -75,8 +76,9 @@ namespace OpenSim.Region.CoreModules.InterGrid
public bool visible_to_parent;
public string teleported_into_region;
}
public class OpenGridProtocolModule : IRegionModule
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class OpenGridProtocolModule : ISharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_scene = new List<Scene>();
@@ -92,21 +94,22 @@ namespace OpenSim.Region.CoreModules.InterGrid
private bool httpSSL = false;
private uint httpsslport = 0;
private bool GridMode = false;
private bool m_enabled = false;
private IConfig cfg = null;
private IConfig httpcfg = null;
private IConfig startupcfg = null;
#region ISharedRegionModule Members
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
public void Initialise(IConfigSource config)
{
bool enabled = false;
IConfig cfg = null;
IConfig httpcfg = null;
IConfig startupcfg = null;
try
{
cfg = config.Configs["OpenGridProtocol"];
} catch (NullReferenceException)
}
catch (NullReferenceException)
{
enabled = false;
m_enabled = false;
}
try
@@ -128,15 +131,15 @@ namespace OpenSim.Region.CoreModules.InterGrid
if (startupcfg != null)
{
GridMode = enabled = startupcfg.GetBoolean("gridmode", false);
GridMode = m_enabled = startupcfg.GetBoolean("gridmode", false);
}
if (cfg != null)
{
enabled = cfg.GetBoolean("ogp_enabled", false);
m_enabled = cfg.GetBoolean("ogp_enabled", false);
LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL");
FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", "");
if (enabled)
if (m_enabled)
{
m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/");
lock (m_scene)
@@ -165,35 +168,61 @@ namespace OpenSim.Region.CoreModules.InterGrid
}
}
// can't pick the region 'agent' because it would conflict with our agent domain handler
// a zero length region name would conflict with are base region seed cap
if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0)
{
MainServer.Instance.AddLLSDHandler(
"/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
ProcessRegionDomainSeed);
}
}
}
}
}
if (!m_scene.Contains(scene))
m_scene.Add(scene);
}
}
}
lock (m_scene)
public Type ReplaceableInterface
{
get { return null; }
}
public void AddRegion(Scene scene)
{
if (m_enabled)
{
if (m_scene.Count == 1)
lock (m_scene)
{
if (httpcfg != null)
if (m_scene.Count == 1)
{
httpSSL = httpcfg.GetBoolean("http_listener_ssl", false);
httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName);
if (httpsCN.Length == 0)
httpsCN = scene.RegionInfo.ExternalHostName;
httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1));
if (httpcfg != null)
{
httpSSL = httpcfg.GetBoolean("http_listener_ssl", false);
httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName);
if (httpsCN.Length == 0)
httpsCN = scene.RegionInfo.ExternalHostName;
httpsslport = (uint)httpcfg.GetInt("http_listener_sslport", ((int)scene.RegionInfo.HttpPort + 1));
}
}
}
// can't pick the region 'agent' because it would conflict with our agent domain handler
// a zero length region name would conflict with are base region seed cap
if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0)
{
MainServer.Instance.AddLLSDHandler(
"/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
ProcessRegionDomainSeed);
}
if (!m_scene.Contains(scene))
m_scene.Add(scene);
}
}
public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
MainServer.Instance.RemoveLLSDHandler(
"/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
ProcessRegionDomainSeed);
if (m_scene.Contains(scene))
m_scene.Remove(scene);
}
public void PostInitialise()
{
@@ -209,11 +238,6 @@ namespace OpenSim.Region.CoreModules.InterGrid
get { return "OpenGridProtocolModule"; }
}
public bool IsSharedModule
{
get { return true; }
}
#endregion
public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint)