diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 427dca59f9..cda4a94d13 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -99,12 +99,12 @@ namespace OpenSim.ApplicationPlugins.LoadRegions RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules..."); - m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule..."); - m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); - m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule..."); - m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); - m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule..."); - m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); + //m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule..."); + //m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); + //m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule..."); + //m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); + //m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule..."); + //m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); // m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); // m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); m_log.Info("[LOAD REGIONS PLUGIN]: Done."); diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs index 49bd911baf..633d0055fd 100644 --- a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs +++ b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs @@ -215,7 +215,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController } } -#region IRegionModulesController implementation +#region Region Module interfacesController implementation /// /// Check that the given module is no disabled in the [Modules] section of the config files. diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 2236e4388a..47252f69f4 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -757,33 +757,13 @@ namespace OpenSim switch (cmdparams[0].ToLower()) { case "list": - foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules) - { - MainConsole.Instance.Output(String.Format("Shared region module: {0}", irm.Name)); - } + //TODO: Convert to new region modules break; case "unload": - if (cmdparams.Length > 1) - { - foreach (IRegionModule rm in new ArrayList(m_moduleLoader.GetLoadedSharedModules)) - { - if (rm.Name.ToLower() == cmdparams[1].ToLower()) - { - MainConsole.Instance.Output(String.Format("Unloading module: {0}", rm.Name)); - m_moduleLoader.UnloadModule(rm); - } - } - } + //TODO: Convert to new region modules break; case "load": - if (cmdparams.Length > 1) - { - foreach (Scene s in new ArrayList(SceneManager.Scenes)) - { - MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1])); - m_moduleLoader.LoadRegionModules(cmdparams[1], s); - } - } + //TODO: Convert to new region modules break; } } @@ -1018,28 +998,9 @@ namespace OpenSim break; case "modules": - MainConsole.Instance.Output("The currently loaded shared modules are:"); - foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) - { - MainConsole.Instance.Output("Shared Module: " + module.Name); - } - SceneManager.ForEachScene( delegate(Scene scene) { - m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); - foreach (IRegionModule module in scene.Modules.Values) - { - if (!module.IsSharedModule) - { - m_log.Error("Region Module: " + module.Name); - } - } - } - ); - - SceneManager.ForEachScene( - delegate(Scene scene) { - MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:"); + MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:"); foreach (IRegionModuleBase module in scene.RegionModules.Values) { Type type = module.GetType().GetInterface("ISharedRegionModule"); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 7b591a88be..a3d6820d57 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -127,14 +127,6 @@ namespace OpenSim get { return m_httpServerPort; } } - public ModuleLoader ModuleLoader - { - get { return m_moduleLoader; } - set { m_moduleLoader = value; } - } - - protected ModuleLoader m_moduleLoader; - protected IRegistryCore m_applicationRegistry = new RegistryCore(); public IRegistryCore ApplicationRegistry @@ -223,9 +215,6 @@ namespace OpenSim base.StartupSpecific(); - // Create a ModuleLoader instance - m_moduleLoader = new ModuleLoader(m_config.Source); - LoadPlugins(); foreach (IApplicationPlugin plugin in m_plugins) { @@ -370,12 +359,6 @@ namespace OpenSim m_log.Info("[MODULES]: Loading Region's modules (old style)"); - List modules = m_moduleLoader.PickupModules(scene, "."); - - // This needs to be ahead of the script engine load, so the - // script module can pick up events exposed by a module - m_moduleLoader.InitialiseSharedModules(scene); - // Use this in the future, the line above will be deprecated soon m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)"); IRegionModulesController controller; @@ -426,13 +409,6 @@ namespace OpenSim clientServer.Start(); } - if (do_post_init) - { - foreach (IRegionModule module in modules) - { - module.PostInitialise(); - } - } scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; mscene = scene; @@ -722,7 +698,7 @@ namespace OpenSim return new Scene( regionInfo, circuitManager, sceneGridService, - simDataService, estateDataService, m_moduleLoader, false, + simDataService, estateDataService, false, m_config.Source, m_version); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs index 66b865f676..b735dfa244 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs @@ -45,7 +45,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.ClientStack.Linden { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BunchOfCapsModule")] public class BunchOfCapsModule : INonSharedRegionModule { // private static readonly ILog m_log = diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 47cb04953f..4d2c0f25fc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -55,8 +55,8 @@ namespace OpenSim.Region.ClientStack.Linden public OSDMap body; } - //[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class EventQueueGetModule : IEventQueue, IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EventQueueGetModule")] + public class EventQueueGetModule : IEventQueue, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -66,8 +66,6 @@ namespace OpenSim.Region.ClientStack.Linden public int DebugLevel { get; set; } protected Scene m_scene; - private IConfigSource m_gConfig; - bool enabledYN; private Dictionary m_ids = new Dictionary(); @@ -75,60 +73,46 @@ namespace OpenSim.Region.ClientStack.Linden private Dictionary m_QueueUUIDAvatarMapping = new Dictionary(); private Dictionary m_AvatarQueueUUIDMapping = new Dictionary(); - #region IRegionModule methods - public virtual void Initialise(Scene scene, IConfigSource config) + #region INonSharedRegionModule methods + public virtual void Initialise(IConfigSource config) { - m_gConfig = config; - - IConfig startupConfig = m_gConfig.Configs["Startup"]; - - ReadConfigAndPopulate(scene, startupConfig, "Startup"); - - if (enabledYN) - { - m_scene = scene; - scene.RegisterModuleInterface(this); - - // Register fallback handler - // Why does EQG Fail on region crossings! - - //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); - -// scene.EventManager.OnNewClient += OnNewClient; - - // TODO: Leaving these open, or closing them when we - // become a child is incorrect. It messes up TP in a big - // way. CAPS/EQ need to be active as long as the UDP - // circuit is there. - - scene.EventManager.OnClientClosed += ClientClosed; - - scene.EventManager.OnMakeChildAgent += MakeChildAgent; - scene.EventManager.OnRegisterCaps += OnRegisterCaps; - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug eq", - "debug eq [0|1|2]", - "Turn on event queue debugging\n" - + " <= 0 - turns off all event queue logging\n" - + " >= 1 - turns on outgoing event logging\n" - + " >= 2 - turns on poll notification", - HandleDebugEq); - } - else - { - m_gConfig = null; - } } - private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) + public void AddRegion(Scene scene) { - enabledYN = startupConfig.GetBoolean("EventQueue", true); + m_scene = scene; + scene.RegisterModuleInterface(this); + + scene.EventManager.OnClientClosed += ClientClosed; + scene.EventManager.OnMakeChildAgent += MakeChildAgent; + scene.EventManager.OnRegisterCaps += OnRegisterCaps; + + MainConsole.Instance.Commands.AddCommand( + "Debug", + false, + "debug eq", + "debug eq [0|1|2]", + "Turn on event queue debugging\n" + + " <= 0 - turns off all event queue logging\n" + + " >= 1 - turns on outgoing event logging\n" + + " >= 2 - turns on poll notification", + HandleDebugEq); } - public void PostInitialise() + public void RemoveRegion(Scene scene) + { + if (m_scene != scene) + return; + + scene.EventManager.OnClientClosed -= ClientClosed; + scene.EventManager.OnMakeChildAgent -= MakeChildAgent; + scene.EventManager.OnRegisterCaps -= OnRegisterCaps; + + scene.UnregisterModuleInterface(this); + m_scene = null; + } + + public void RegionLoaded(Scene scene) { } @@ -141,10 +125,11 @@ namespace OpenSim.Region.ClientStack.Linden get { return "EventQueueGetModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return false; } + get { return null; } } + #endregion protected void HandleDebugEq(string module, string[] args) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs index cb5afcc38f..87d3d1c676 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.Linden /// /// This module implements both WebFetchInventoryDescendents and FetchInventoryDescendents2 capabilities. /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FetchInventory2Module")] public class FetchInventory2Module : INonSharedRegionModule { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 0d7b1fc6e6..8e1f63aff7 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -47,7 +47,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.ClientStack.Linden { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetMeshModule")] public class GetMeshModule : INonSharedRegionModule { // private static readonly ILog m_log = @@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_Enabled = true; private string m_URL; - #region IRegionModuleBase Members + #region Region Module interfaceBase Members public Type ReplaceableInterface { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 5ae9cc3307..13415f82fc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -51,7 +51,7 @@ using OpenSim.Capabilities.Handlers; namespace OpenSim.Region.ClientStack.Linden { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")] public class GetTextureModule : INonSharedRegionModule { // private static readonly ILog m_log = diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs index 44a68839ca..33b1f77bab 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.Linden /// /// MeshUploadFlag capability. This is required for uploading Mesh. /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MeshUploadFlagModule")] public class MeshUploadFlagModule : INonSharedRegionModule { // private static readonly ILog m_log = diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 52c4f44c8c..5529550fe1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs @@ -47,7 +47,7 @@ using OpenSim.Framework.Capabilities; namespace OpenSim.Region.ClientStack.Linden { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NewFileAgentInventoryVariablePriceModule")] public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_enabled = true; private int m_levelUpload = 0; - #region IRegionModuleBase Members + #region Region Module interfaceBase Members public Type ReplaceableInterface @@ -98,7 +98,7 @@ namespace OpenSim.Region.ClientStack.Linden #endregion - #region IRegionModule Members + #region Region Module interface diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs index 4ccfc434a6..92805e26ea 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs @@ -32,6 +32,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; @@ -41,30 +42,60 @@ using Caps=OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.ClientStack.Linden { - public class ObjectAdd : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ObjectAdd")] + public class ObjectAdd : INonSharedRegionModule { // private static readonly ILog m_log = // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; - #region IRegionModule Members - public void Initialise(Scene pScene, IConfigSource pSource) + #region INonSharedRegionModule Members + + public void Initialise(IConfigSource pSource) { - m_scene = pScene; + } + + public void AddRegion(Scene scene) + { + m_scene = scene; m_scene.EventManager.OnRegisterCaps += RegisterCaps; } - public void PostInitialise() + public void RemoveRegion(Scene scene) { - + if (m_scene == scene) + { + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } } + public void RegionLoaded(Scene scene) + { + } + + public void Close() + { + } + + public string Name + { + get { return "ObjectAddModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion + public void RegisterCaps(UUID agentID, Caps caps) { UUID capuuid = UUID.Random(); - -// m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/"); + + // m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/"); caps.RegisterHandler( "ObjectAdd", @@ -73,7 +104,7 @@ namespace OpenSim.Region.ClientStack.Linden "/CAPS/OA/" + capuuid + "/", httpMethod => ProcessAdd(httpMethod, agentID, caps), "ObjectAdd", - agentID.ToString()));; + agentID.ToString())); ; } public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap) @@ -84,7 +115,7 @@ namespace OpenSim.Region.ClientStack.Linden responsedata["keepalive"] = false; responsedata["str_response_string"] = "Request wasn't what was expected"; ScenePresence avatar; - + if (!m_scene.TryGetScenePresence(AgentId, out avatar)) return responsedata; @@ -127,7 +158,7 @@ namespace OpenSim.Region.ClientStack.Linden if (r.Type != OSDType.Map) // not a proper req return responsedata; - + OSDMap rm = (OSDMap)r; if (rm.ContainsKey("ObjectData")) //v2 @@ -138,7 +169,7 @@ namespace OpenSim.Region.ClientStack.Linden return responsedata; } - OSDMap ObjMap = (OSDMap) rm["ObjectData"]; + OSDMap ObjMap = (OSDMap)rm["ObjectData"]; bypass_raycast = ObjMap["BypassRaycast"].AsBoolean(); everyone_mask = readuintval(ObjMap["EveryoneMask"]); @@ -181,7 +212,7 @@ namespace OpenSim.Region.ClientStack.Linden responsedata["str_response_string"] = "Has Profile key, but data not in expected format"; return responsedata; } - + OSDMap ProfileMap = (OSDMap)ObjMap["Profile"]; profile_begin = ProfileMap["Begin"].AsInteger(); @@ -190,14 +221,14 @@ namespace OpenSim.Region.ClientStack.Linden hollow = ProfileMap["Hollow"].AsInteger(); } ray_end_is_intersection = ObjMap["RayEndIsIntersection"].AsBoolean(); - + ray_target_id = ObjMap["RayTargetId"].AsUUID(); state = ObjMap["State"].AsInteger(); try { - ray_end = ((OSDArray) ObjMap["RayEnd"]).AsVector3(); - ray_start = ((OSDArray) ObjMap["RayStart"]).AsVector3(); - scale = ((OSDArray) ObjMap["Scale"]).AsVector3(); + ray_end = ((OSDArray)ObjMap["RayEnd"]).AsVector3(); + ray_start = ((OSDArray)ObjMap["RayStart"]).AsVector3(); + scale = ((OSDArray)ObjMap["Scale"]).AsVector3(); rotation = ((OSDArray)ObjMap["Rotation"]).AsQuaternion(); } catch (Exception) @@ -214,7 +245,7 @@ namespace OpenSim.Region.ClientStack.Linden return responsedata; } - OSDMap AgentDataMap = (OSDMap) rm["AgentData"]; + OSDMap AgentDataMap = (OSDMap)rm["AgentData"]; //session_id = AgentDataMap["SessionId"].AsUUID(); group_id = AgentDataMap["GroupId"].AsUUID(); @@ -251,21 +282,21 @@ namespace OpenSim.Region.ClientStack.Linden profile_begin = rm["profile_begin"].AsInteger(); profile_curve = rm["profile_curve"].AsInteger(); profile_end = rm["profile_end"].AsInteger(); - + ray_end_is_intersection = rm["ray_end_is_intersection"].AsBoolean(); - + ray_target_id = rm["ray_target_id"].AsUUID(); - - + + //session_id = rm["session_id"].AsUUID(); state = rm["state"].AsInteger(); - try + try { ray_end = ((OSDArray)rm["ray_end"]).AsVector3(); ray_start = ((OSDArray)rm["ray_start"]).AsVector3(); rotation = ((OSDArray)rm["rotation"]).AsQuaternion(); scale = ((OSDArray)rm["scale"]).AsVector3(); - } + } catch (Exception) { responsedata["str_response_string"] = "RayEnd, RayStart, Scale or Rotation wasn't in the expected format"; @@ -273,9 +304,9 @@ namespace OpenSim.Region.ClientStack.Linden } } - - Vector3 pos = m_scene.GetNewRezLocation(ray_start, ray_end, ray_target_id, rotation, (bypass_raycast) ? (byte)1 : (byte)0, (ray_end_is_intersection) ? (byte)1 : (byte)0, true, scale, false); + + Vector3 pos = m_scene.GetNewRezLocation(ray_start, ray_end, ray_target_id, rotation, (bypass_raycast) ? (byte)1 : (byte)0, (ray_end_is_intersection) ? (byte)1 : (byte)0, true, scale, false); PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); @@ -286,17 +317,17 @@ namespace OpenSim.Region.ClientStack.Linden pbs.PathRevolutions = (byte)path_revolutions; pbs.PathScaleX = (byte)path_scale_x; pbs.PathScaleY = (byte)path_scale_y; - pbs.PathShearX = (byte) path_shear_x; + pbs.PathShearX = (byte)path_shear_x; pbs.PathShearY = (byte)path_shear_y; pbs.PathSkew = (sbyte)path_skew; pbs.PathTaperX = (sbyte)path_taper_x; pbs.PathTaperY = (sbyte)path_taper_y; pbs.PathTwist = (sbyte)path_twist; pbs.PathTwistBegin = (sbyte)path_twist_begin; - pbs.HollowShape = (HollowShape) hollow; + pbs.HollowShape = (HollowShape)hollow; pbs.PCode = (byte)p_code; - pbs.ProfileBegin = (ushort) profile_begin; - pbs.ProfileCurve = (byte) profile_curve; + pbs.ProfileBegin = (ushort)profile_begin; + pbs.ProfileCurve = (byte)profile_curve; pbs.ProfileEnd = (ushort)profile_end; pbs.Scale = scale; pbs.State = (byte)state; @@ -306,7 +337,7 @@ namespace OpenSim.Region.ClientStack.Linden if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) { // rez ON the ground, not IN the ground - // pos.Z += 0.25F; + // pos.Z += 0.25F; obj = m_scene.AddNewPrim(avatar.UUID, group_id, pos, rotation, pbs); } @@ -323,13 +354,13 @@ namespace OpenSim.Region.ClientStack.Linden rootpart.GroupMask = group_mask; rootpart.NextOwnerMask = next_owner_mask; rootpart.Material = (byte)material; - + m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); - + responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["content_type"] = "text/plain"; responsedata["keepalive"] = false; - responsedata["str_response_string"] = String.Format("local_id{0}",ConvertUintToBytes(obj.LocalId)); + responsedata["str_response_string"] = String.Format("local_id{0}", ConvertUintToBytes(obj.LocalId)); return responsedata; } @@ -347,24 +378,8 @@ namespace OpenSim.Region.ClientStack.Linden byte[] resultbytes = Utils.UIntToBytes(val); if (BitConverter.IsLittleEndian) Array.Reverse(resultbytes); - return String.Format("{0}",Convert.ToBase64String(resultbytes)); + return String.Format("{0}", Convert.ToBase64String(resultbytes)); } - public void Close() - { - - } - - public string Name - { - get { return "ObjectAddModule"; } - } - - public bool IsSharedModule - { - get { return false; } - } - - #endregion } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index ba902b2a3b..55a503e68c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs @@ -51,14 +51,14 @@ using ExtraParamType = OpenMetaverse.ExtraParamType; namespace OpenSim.Region.ClientStack.Linden { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UploadObjectAssetModule")] public class UploadObjectAssetModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; - #region IRegionModuleBase Members + #region Region Module interfaceBase Members public Type ReplaceableInterface @@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.Linden #endregion - #region IRegionModule Members + #region Region Module interface diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 8ed0fb3e1f..191bccf812 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.ClientStack.Linden /// NOTE: Part of this code was adapted from the Aurora project, specifically /// the normal part of the response in the capability handler. /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimulatorFeaturesModule")] public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule { // private static readonly ILog m_log = diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 6aac5911ee..3b0ccd75ec 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -50,7 +50,7 @@ using OpenSim.Capabilities.Handlers; namespace OpenSim.Region.ClientStack.Linden { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UploadBakedTextureModule")] public class UploadBakedTextureModule : INonSharedRegionModule { // private static readonly ILog m_log = diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 2359bd6683..6890f4a7e6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.Linden /// /// This module implements both WebFetchInventoryDescendents and FetchInventoryDescendents2 capabilities. /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")] public class WebFetchInvDescModule : INonSharedRegionModule { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 73d1f72b2a..e97365204e 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction private Dictionary AgentTransactions = new Dictionary(); - #region IRegionModule Members + #region Region Module interface public void Initialise(IConfigSource source) { diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs index bfe2a716af..4b457b1e45 100644 --- a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs +++ b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Text; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -36,13 +37,18 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Agent.IPBan { - public class IPBanModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "IPBanModule")] + public class IPBanModule : ISharedRegionModule { - #region Implementation of IRegionModule + #region Implementation of ISharedRegionModule private List m_bans = new List(); - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { new SceneBanner(scene, m_bans); @@ -50,7 +56,7 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan { foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans) { - if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) + if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) m_bans.Add(ban.BannedHostIPMask); if (!String.IsNullOrEmpty(ban.BannedHostNameMask)) m_bans.Add(ban.BannedHostNameMask); @@ -58,6 +64,14 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan } } + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) + { + } + public void PostInitialise() { if (File.Exists("bans.txt")) @@ -80,9 +94,9 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan get { return "IPBanModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index a1a250176d..37646855ca 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -32,6 +32,7 @@ using System.Reflection; using System.Text; using System.Threading; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -45,7 +46,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { public delegate void J2KDecodeDelegate(UUID assetID); - public class J2KDecoderModule : IRegionModule, IJ2KDecoder + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "J2KDecoderModule")] + public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -55,27 +57,32 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender private readonly Dictionary> m_notifyList = new Dictionary>(); /// Cache that will store decoded JPEG2000 layer boundary data private IImprovedAssetCache m_cache; + private IImprovedAssetCache Cache + { + get + { + if (m_cache == null) + m_cache = m_scene.RequestModuleInterface(); + + return m_cache; + } + } /// Reference to a scene (doesn't matter which one as long as it can load the cache module) + private UUID m_CreatorID = UUID.Zero; private Scene m_scene; - #region IRegionModule + #region ISharedRegionModule private bool m_useCSJ2K = true; public string Name { get { return "J2KDecoderModule"; } } - public bool IsSharedModule { get { return true; } } public J2KDecoderModule() { } - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { - if (m_scene == null) - m_scene = scene; - - scene.RegisterModuleInterface(this); - IConfig startupConfig = source.Configs["Startup"]; if (startupConfig != null) { @@ -83,16 +90,42 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender } } + public void AddRegion(Scene scene) + { + if (m_scene == null) + { + m_scene = scene; + m_CreatorID = scene.RegionInfo.RegionID; + } + + scene.RegisterModuleInterface(this); + + } + + public void RemoveRegion(Scene scene) + { + if (m_scene == scene) + m_scene = null; + } + public void PostInitialise() { - m_cache = m_scene.RequestModuleInterface(); } public void Close() { } - #endregion IRegionModule + public void RegionLoaded(Scene scene) + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion Region Module interface #region IJ2KDecoder @@ -275,11 +308,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10)); - if (m_cache != null) + if (Cache != null) { string assetID = "j2kCache_" + AssetId.ToString(); - AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID.ToString()); + AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_CreatorID.ToString()); layerDecodeAsset.Local = true; layerDecodeAsset.Temporary = true; @@ -299,7 +332,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender #endregion Serialize Layer Data - m_cache.Cache(layerDecodeAsset); + Cache.Cache(layerDecodeAsset); } } @@ -309,10 +342,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { return true; } - else if (m_cache != null) + else if (Cache != null) { string assetName = "j2kCache_" + AssetId.ToString(); - AssetBase layerDecodeAsset = m_cache.Get(assetName); + AssetBase layerDecodeAsset = Cache.Get(assetName); if (layerDecodeAsset != null) { @@ -324,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender if (lines.Length == 0) { m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName); - m_cache.Expire(assetName); + Cache.Expire(assetName); return false; } @@ -345,7 +378,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender catch (FormatException) { m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName); - m_cache.Expire(assetName); + Cache.Expire(assetName); return false; } @@ -356,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender else { m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName); - m_cache.Expire(assetName); + Cache.Expire(assetName); return false; } } diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index b8e2820db7..4299726055 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -35,9 +35,12 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using Mono.Addins; + namespace OpenSim.Region.CoreModules.Agent.Xfer { - public class XferModule : IRegionModule, IXfer + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XferModule")] + public class XferModule : INonSharedRegionModule, IXfer { private Scene m_scene; private Dictionary NewFiles = new Dictionary(); @@ -59,9 +62,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer public int Count; } - #region IRegionModule Members + #region INonSharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) + { + } + + public void AddRegion(Scene scene) { m_scene = scene; m_scene.EventManager.OnNewClient += NewClient; @@ -69,8 +76,21 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer m_scene.RegisterModuleInterface(this); } - public void PostInitialise() + public void RemoveRegion(Scene scene) { + m_scene.EventManager.OnNewClient -= NewClient; + + m_scene.UnregisterModuleInterface(this); + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { + } + + public Type ReplaceableInterface + { + get { return null; } } public void Close() @@ -82,11 +102,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer get { return "XferModule"; } } - public bool IsSharedModule - { - get { return false; } - } - #endregion #region IXfer Members diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index b1b7b27a6c..e40caeca4d 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs @@ -28,6 +28,7 @@ using System; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -89,6 +90,7 @@ namespace OpenSim.Region.CoreModules.Asset /// ExpirationTime = 60 /// /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CenomeMemoryAssetCache")] public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs index 7da5e7ace9..9742a5caa4 100644 --- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs @@ -30,6 +30,7 @@ using System; using System.IO; using System.Collections.Generic; using System.Reflection; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -38,6 +39,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Asset { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CoreAssetCache")] public class CoreAssetCache : ISharedRegionModule, IImprovedAssetCache { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 8aa173ab2b..232d9f507f 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -49,12 +49,12 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; -[assembly: Addin("FlotsamAssetCache", "1.1")] -[assembly: AddinDependency("OpenSim", "0.5")] +//[assembly: Addin("FlotsamAssetCache", "1.1")] +//[assembly: AddinDependency("OpenSim", "0.5")] namespace OpenSim.Region.CoreModules.Asset { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FlotsamAssetCache")] public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache, IAssetService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs index 1365e69117..9592ca0019 100644 --- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs @@ -31,6 +31,7 @@ using System.IO; using System.Collections.Generic; using System.Reflection; using GlynnTucker.Cache; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -39,6 +40,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Asset { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GlynnTuckerAssetCache")] public class GlynnTuckerAssetCache : ISharedRegionModule, IImprovedAssetCache { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index b5b00825f4..0a69979d34 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -39,9 +39,12 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; +using Mono.Addins; + namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { - public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AvatarFactoryModule")] + public class AvatarFactoryModule : IAvatarFactoryModule, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -59,12 +62,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory private object m_setAppearanceLock = new object(); - #region IRegionModule + #region Region Module interface - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - scene.RegisterModuleInterface(this); - scene.EventManager.OnNewClient += SubscribeToClientEvents; IConfig appearanceConfig = config.Configs["Appearance"]; if (appearanceConfig != null) @@ -74,11 +75,29 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); } - if (m_scene == null) - m_scene = scene; } - public void PostInitialise() + public void AddRegion(Scene scene) + { + if (m_scene == null) + m_scene = scene; + + scene.RegisterModuleInterface(this); + scene.EventManager.OnNewClient += SubscribeToClientEvents; + } + + public void RemoveRegion(Scene scene) + { + if (scene == m_scene) + { + scene.UnregisterModuleInterface(this); + scene.EventManager.OnNewClient -= SubscribeToClientEvents; + } + + m_scene = null; + } + + public void RegionLoaded(Scene scene) { m_updateTimer.Enabled = false; m_updateTimer.AutoReset = true; @@ -100,6 +119,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory get { return false; } } + public Type ReplaceableInterface + { + get { return null; } + } + + private void SubscribeToClientEvents(IClientAPI client) { client.OnRequestWearables += Client_OnRequestWearables; diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index ddf92c3e44..6d62ff0f92 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Chat { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ChatModule")] public class ChatModule : ISharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 3a9146557d..343cdb5c1e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -33,9 +33,12 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenMetaverse; +using Mono.Addins; + namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule { - public class CombatModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CombatModule")] + public class CombatModule : ISharedRegionModule { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -54,7 +57,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule /// /// /// - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) + { + } + + public void AddRegion(Scene scene) { lock (m_scenel) { @@ -72,6 +79,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; } + public void RemoveRegion(Scene scene) + { + if (m_scenel.ContainsKey(scene.RegionInfo.RegionHandle)) + m_scenel.Remove(scene.RegionInfo.RegionHandle); + + scene.EventManager.OnAvatarKilled -= KillAvatar; + scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; + } + + public void RegionLoaded(Scene scene) + { + } + public void PostInitialise() { } @@ -85,11 +105,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule get { return "CombatModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } + private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar) { string deadAvatarMessage; diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 325067c9ff..d26907b322 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -32,6 +32,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using Mono.Addins; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -39,16 +40,27 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Dialog { - public class DialogModule : IRegionModule, IDialogModule - { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DialogModule")] + public class DialogModule : IDialogModule, INonSharedRegionModule + { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + protected Scene m_scene; - - public void Initialise(Scene scene, IConfigSource source) + + public void Initialise(IConfigSource source) { } + + public Type ReplaceableInterface { get { return null; } } + + public void AddRegion(Scene scene) { m_scene = scene; m_scene.RegisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + if (scene != m_scene) + return; m_scene.AddCommand( "Users", this, "alert", "alert ", @@ -56,46 +68,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog HandleAlertConsoleCommand); m_scene.AddCommand( - "Users", this, "alert-user", "alert-user ", + "Users", this, "alert-user", + "alert-user ", "Send an alert to a user", HandleAlertConsoleCommand); } - - public void PostInitialise() {} - public void Close() {} + + public void RemoveRegion(Scene scene) + { + if (scene != m_scene) + return; + + m_scene.UnregisterModuleInterface(this); + } + + public void Close() { } public string Name { get { return "Dialog Module"; } } - public bool IsSharedModule { get { return false; } } - + public void SendAlertToUser(IClientAPI client, string message) { SendAlertToUser(client, message, false); } - - public void SendAlertToUser(IClientAPI client, string message, bool modal) + + public void SendAlertToUser(IClientAPI client, string message, + bool modal) { client.SendAgentAlertMessage(message, modal); - } - + } + public void SendAlertToUser(UUID agentID, string message) { SendAlertToUser(agentID, message, false); } - + public void SendAlertToUser(UUID agentID, string message, bool modal) { ScenePresence sp = m_scene.GetScenePresence(agentID); - + if (sp != null) sp.ControllingClient.SendAgentAlertMessage(message, modal); } - - public void SendAlertToUser(string firstName, string lastName, string message, bool modal) + + public void SendAlertToUser(string firstName, string lastName, + string message, bool modal) { - ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); + ScenePresence presence = m_scene.GetScenePresence(firstName, + lastName); if (presence != null) - presence.ControllingClient.SendAgentAlertMessage(message, modal); + { + presence.ControllingClient.SendAgentAlertMessage(message, + modal); + } } - + public void SendGeneralAlert(string message) { m_scene.ForEachRootClient(delegate(IClientAPI client) @@ -104,11 +129,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog }); } - public void SendDialogToUser( - UUID avatarID, string objectName, UUID objectID, UUID ownerID, - string message, UUID textureID, int ch, string[] buttonlabels) + public void SendDialogToUser(UUID avatarID, string objectName, + UUID objectID, UUID ownerID, string message, UUID textureID, + int ch, string[] buttonlabels) { - UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); + UserAccount account = m_scene.UserAccountService.GetUserAccount( + m_scene.RegionInfo.ScopeID, ownerID); string ownerFirstName, ownerLastName; if (account != null) { @@ -123,29 +149,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog ScenePresence sp = m_scene.GetScenePresence(avatarID); if (sp != null) - sp.ControllingClient.SendDialog( - objectName, objectID, ownerID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); + { + sp.ControllingClient.SendDialog(objectName, objectID, ownerID, + ownerFirstName, ownerLastName, message, textureID, ch, + buttonlabels); + } } - public void SendUrlToUser( - UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) + public void SendUrlToUser(UUID avatarID, string objectName, + UUID objectID, UUID ownerID, bool groupOwned, string message, + string url) { ScenePresence sp = m_scene.GetScenePresence(avatarID); - + if (sp != null) - sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); + { + sp.ControllingClient.SendLoadURL(objectName, objectID, + ownerID, groupOwned, message, url); + } } - - public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) + + public void SendTextBoxToUser(UUID avatarid, string message, + int chatChannel, string name, UUID objectid, UUID ownerid) { - UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); + UserAccount account = m_scene.UserAccountService.GetUserAccount( + m_scene.RegionInfo.ScopeID, ownerid); string ownerFirstName, ownerLastName; - UUID ownerID = UUID.Zero; + UUID ownerID = UUID.Zero; if (account != null) { ownerFirstName = account.FirstName; ownerLastName = account.LastName; - ownerID = account.PrincipalID; + ownerID = account.PrincipalID; } else { @@ -154,29 +189,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog } ScenePresence sp = m_scene.GetScenePresence(avatarid); - + if (sp != null) - sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerID, ownerFirstName, ownerLastName, objectid); + { + sp.ControllingClient.SendTextBoxRequest(message, chatChannel, + name, ownerID, ownerFirstName, ownerLastName, + objectid); + } } - public void SendNotificationToUsersInRegion( - UUID fromAvatarID, string fromAvatarName, string message) + public void SendNotificationToUsersInRegion(UUID fromAvatarID, + string fromAvatarName, string message) { m_scene.ForEachRootClient(delegate(IClientAPI client) { - client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); + client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, + message); }); } - + /// /// Handle an alert command from the console. /// /// /// - public void HandleAlertConsoleCommand(string module, string[] cmdparams) + public void HandleAlertConsoleCommand(string module, + string[] cmdparams) { - if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) + if (m_scene.ConsoleScene() != null && + m_scene.ConsoleScene() != m_scene) + { return; + } string message = string.Empty; @@ -184,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { message = CombineParams(cmdparams, 1); m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", - m_scene.RegionInfo.RegionName, message); + m_scene.RegionInfo.RegionName, message); SendGeneralAlert(message); } else if (cmdparams.Length > 3) @@ -192,9 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog string firstName = cmdparams[1]; string lastName = cmdparams[2]; message = CombineParams(cmdparams, 3); - m_log.InfoFormat( - "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", - m_scene.RegionInfo.RegionName, firstName, lastName, message); + m_log.InfoFormat("[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", + m_scene.RegionInfo.RegionName, firstName, lastName, + message); SendAlertToUser(firstName, lastName, message, false); } else @@ -212,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { result += commandParams[i] + " "; } - + return result; } } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index f1903c3e27..8056030843 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -35,6 +35,7 @@ using log4net; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Communications; @@ -50,6 +51,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Avatar.Friends { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FriendsModule")] public class FriendsModule : ISharedRegionModule, IFriendsModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 06f27e23df..bf5c0bb46b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -46,6 +46,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Avatar.Friends { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGFriendsModule")] public class HGFriendsModule : FriendsModule, ISharedRegionModule, IFriendsModule, IFriendsSimConnector { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index 7df2beb5df..095c57b2bc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Reflection; using log4net; using Nini.Config; @@ -35,26 +36,46 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; +using Mono.Addins; + namespace OpenSim.Region.CoreModules.Avatar.Gestures { - public class GesturesModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GesturesModule")] + public class GesturesModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { m_scene = scene; - + m_scene.EventManager.OnNewClient += OnNewClient; } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + m_scene.EventManager.OnNewClient -= OnNewClient; + m_scene = null; + } - public void PostInitialise() {} public void Close() {} public string Name { get { return "Gestures Module"; } } - public bool IsSharedModule { get { return false; } } - + + public Type ReplaceableInterface + { + get { return null; } + } + private void OnNewClient(IClientAPI client) { client.OnActivateGesture += ActivateGesture; diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 81ce2688d3..5a7446f3d1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using Nini.Config; using OpenMetaverse; @@ -32,29 +33,59 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; +using Mono.Addins; + namespace OpenSim.Region.CoreModules.Avatar.Gods { - public class GodsModule : IRegionModule, IGodsModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GodsModule")] + public class GodsModule : INonSharedRegionModule, IGodsModule { /// Special UUID for actions that apply to all agents private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); protected Scene m_scene; protected IDialogModule m_dialogModule; - - public void Initialise(Scene scene, IConfigSource source) + protected IDialogModule DialogModule + { + get + { + if (m_dialogModule == null) + m_dialogModule = m_scene.RequestModuleInterface(); + + return m_dialogModule; + } + } + + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { m_scene = scene; - m_dialogModule = m_scene.RequestModuleInterface(); m_scene.RegisterModuleInterface(this); m_scene.EventManager.OnNewClient += SubscribeToClientEvents; } - - public void PostInitialise() {} + + public void RemoveRegion(Scene scene) + { + m_scene.UnregisterModuleInterface(this); + m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { + } + public void Close() {} public string Name { get { return "Gods Module"; } } - public bool IsSharedModule { get { return false; } } - + + public Type ReplaceableInterface + { + get { return null; } + } + public void SubscribeToClientEvents(IClientAPI client) { client.OnGodKickUser += KickUser; @@ -96,8 +127,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods } else { - if (m_dialogModule != null) - m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); + if (DialogModule != null) + DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); } } } @@ -121,7 +152,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods if (sp != null || agentID == kickUserID) { - m_dialogModule = m_scene.RequestModuleInterface(); if (m_scene.Permissions.IsGod(godID)) { if (kickflags == 0) @@ -163,27 +193,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods if (kickflags == 1) { sp.AllowMovement = false; - if (m_dialogModule != null) + if (DialogModule != null) { - m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); - m_dialogModule.SendAlertToUser(godID, "User Frozen"); + DialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); + DialogModule.SendAlertToUser(godID, "User Frozen"); } } if (kickflags == 2) { sp.AllowMovement = true; - if (m_dialogModule != null) + if (DialogModule != null) { - m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); - m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); + DialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); + DialogModule.SendAlertToUser(godID, "User Unfrozen"); } } } else { - if (m_dialogModule != null) - m_dialogModule.SendAlertToUser(godID, "Kick request denied"); + if (DialogModule != null) + DialogModule.SendAlertToUser(godID, "Kick request denied"); } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index b258e13dce..af54c1a1de 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using System.Reflection; using log4net; @@ -34,9 +35,12 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using Mono.Addins; + namespace OpenSim.Region.CoreModules.Avatar.Groups { - public class GroupsModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsModule")] + public class GroupsModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -55,9 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups private static GroupMembershipData osGroup = new GroupMembershipData(); - #region IRegionModule Members + private bool m_Enabled = false; - public void Initialise(Scene scene, IConfigSource config) + #region ISharedRegionModule Members + + public void Initialise(IConfigSource config) { IConfig groupsConfig = config.Configs["Groups"]; @@ -67,7 +73,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups } else { - if (!groupsConfig.GetBoolean("Enabled", false)) + m_Enabled = groupsConfig.GetBoolean("Enabled", false); + if (!m_Enabled) { m_log.Info("[GROUPS]: Groups disabled in configuration"); return; @@ -77,6 +84,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups return; } + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + lock (m_SceneList) { if (!m_SceneList.Contains(scene)) @@ -96,7 +110,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += OnClientClosed; -// scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; + // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + + lock (m_SceneList) + { + if (m_SceneList.Contains(scene)) + m_SceneList.Remove(scene); + } + + scene.EventManager.OnNewClient -= OnNewClient; + scene.EventManager.OnClientClosed -= OnClientClosed; + } + + public void RegionLoaded(Scene scene) + { } public void PostInitialise() @@ -105,6 +138,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups public void Close() { + if (!m_Enabled) + return; + // m_log.Debug("[GROUPS]: Shutting down group module."); lock (m_ClientMap) @@ -123,9 +159,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups get { return "GroupsModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index bf1d78760b..7bf19c268f 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs @@ -48,7 +48,7 @@ using OpenSim.Server.Handlers.Hypergrid; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGMessageTransferModule")] public class HGMessageTransferModule : ISharedRegionModule, IMessageTransferModule, IInstantMessageSimConnector { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index ca5d485657..c33a2960b0 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InstantMessageModule")] public class InstantMessageModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private readonly List m_scenes = new List(); - #region IRegionModule Members + #region Region Module interface private IMessageTransferModule m_TransferModule = null; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 596174b3cd..39833695e6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Net; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -43,6 +44,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MessageTransferModule")] public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs index 24cbaeb9f5..7ce2813139 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs @@ -29,6 +29,7 @@ using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; @@ -39,6 +40,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MuteListModule")] public class MuteListModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index de25048b45..4aaf1feab1 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,6 +40,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")] public class OfflineMessageModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs index dd17f3c26b..4c678c240f 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs @@ -33,6 +33,7 @@ using log4net; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -42,6 +43,7 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PresenceModule")] public class PresenceModule : ISharedRegionModule, IPresenceModule { private static readonly ILog m_log = LogManager.GetLogger( diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index fdba68220a..849449b323 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -39,20 +39,18 @@ using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { /// /// This module loads and saves OpenSimulator inventory archives /// - public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InventoryArchiverModule")] + public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public string Name { get { return "Inventory Archiver Module"; } } - - public bool IsSharedModule { get { return true; } } - /// /// Enable or disable checking whether the iar user is actually logged in /// @@ -99,9 +97,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // public InventoryArchiverModule(bool disablePresenceChecks) // { // DisablePresenceChecks = disablePresenceChecks; -// } + // } - public void Initialise(Scene scene, IConfigSource source) + #region ISharedRegionModule + + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { if (m_scenes.Count == 0) { @@ -144,10 +148,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_scenes[scene.RegionInfo.RegionID] = scene; } - public void PostInitialise() {} + public void RemoveRegion(Scene scene) + { + } public void Close() {} + public void RegionLoaded(Scene scene) + { + } + + public void PostInitialise() + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public string Name { get { return "Inventory Archiver Module"; } } + + #endregion + /// /// Trigger the inventory archive saved event. /// diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index e200775f03..582aac4763 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -38,6 +39,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InventoryTransferModule")] public class InventoryTransferModule : ISharedRegionModule { private static readonly ILog m_log @@ -51,7 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer private IMessageTransferModule m_TransferModule = null; private bool m_Enabled = true; - #region IRegionModule Members + #region Region Module interface public void Initialise(IConfigSource config) { @@ -298,73 +300,76 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer } } - // XXX: This code was placed here to try and accomdate RLV which moves given folders named #RLV/~ - // to a folder called name in #RLV. However, this approach may not be ultimately correct - from analysis - // of Firestorm 4.2.2 on sending an InventoryOffered instead of TaskInventoryOffered (as was previously - // done), the viewer itself would appear to move and rename the folder, rather than the simulator doing it here. - else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) - { - UUID destinationFolderID = UUID.Zero; - - if (im.binaryBucket != null && im.binaryBucket.Length >= 16) - { - destinationFolderID = new UUID(im.binaryBucket, 0); - } - - if (destinationFolderID != UUID.Zero) - { - InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); - if (destinationFolder == null) - { - m_log.WarnFormat( - "[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist", - client.Name, scene.Name, destinationFolderID); - - return; - } - - IInventoryService invService = scene.InventoryService; - - UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip - - InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); - item = invService.GetItem(item); - InventoryFolderBase folder = null; - UUID? previousParentFolderID = null; - - if (item != null) // It's an item - { - previousParentFolderID = item.Folder; - item.Folder = destinationFolderID; - - invService.DeleteItems(item.Owner, new List() { item.ID }); - scene.AddInventoryItem(client, item); - } - else - { - folder = new InventoryFolderBase(inventoryID, client.AgentId); - folder = invService.GetFolder(folder); - - if (folder != null) // It's a folder - { - previousParentFolderID = folder.ParentID; - folder.ParentID = destinationFolderID; - invService.MoveFolder(folder); - } - } - - // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). - if (previousParentFolderID != null) - { - InventoryFolderBase previousParentFolder - = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); - previousParentFolder = invService.GetFolder(previousParentFolder); - scene.SendInventoryUpdate(client, previousParentFolder, true, true); - - scene.SendInventoryUpdate(client, destinationFolder, true, true); - } - } - } + // Disabled for now as it looks like http://opensimulator.org/mantis/view.php?id=6311 was fixed by fixes + // to inventory folder versioning allowing the viewer to move the received folder itself as happens on the + // LL grid. Doing it again server-side then wrongly does a second create and move +// // XXX: This code was placed here to try and accomdate RLV which moves given folders named #RLV/~ +// // to a folder called name in #RLV. However, this approach may not be ultimately correct - from analysis +// // of Firestorm 4.2.2 on sending an InventoryOffered instead of TaskInventoryOffered (as was previously +// // done), the viewer itself would appear to move and rename the folder, rather than the simulator doing it here. +// else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) +// { +// UUID destinationFolderID = UUID.Zero; +// +// if (im.binaryBucket != null && im.binaryBucket.Length >= 16) +// { +// destinationFolderID = new UUID(im.binaryBucket, 0); +// } +// +// if (destinationFolderID != UUID.Zero) +// { +// InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); +// if (destinationFolder == null) +// { +// m_log.WarnFormat( +// "[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist", +// client.Name, scene.Name, destinationFolderID); +// +// return; +// } +// +// IInventoryService invService = scene.InventoryService; +// +// UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip +// +// InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); +// item = invService.GetItem(item); +// InventoryFolderBase folder = null; +// UUID? previousParentFolderID = null; +// +// if (item != null) // It's an item +// { +// previousParentFolderID = item.Folder; +// item.Folder = destinationFolderID; +// +// invService.DeleteItems(item.Owner, new List() { item.ID }); +// scene.AddInventoryItem(client, item); +// } +// else +// { +// folder = new InventoryFolderBase(inventoryID, client.AgentId); +// folder = invService.GetFolder(folder); +// +// if (folder != null) // It's a folder +// { +// previousParentFolderID = folder.ParentID; +// folder.ParentID = destinationFolderID; +// invService.MoveFolder(folder); +// } +// } +// +// // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). +// if (previousParentFolderID != null) +// { +// InventoryFolderBase previousParentFolder +// = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); +// previousParentFolder = invService.GetFolder(previousParentFolder); +// scene.SendInventoryUpdate(client, previousParentFolder, true, true); +// +// scene.SendInventoryUpdate(client, destinationFolder, true, true); +// } +// } +// } else if ( im.dialog == (byte)InstantMessageDialog.InventoryDeclined || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index 9c369f6060..232a4fe5ae 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs @@ -42,7 +42,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Avatar.Lure { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGLureModule")] public class HGLureModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index 6ce9556e67..e4b0cfa734 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Lure { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LureModule")] public class LureModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index 87ca3277be..bf24030771 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs @@ -42,7 +42,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Profile { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicProfileModule")] public class BasicProfileModule : IProfileModule, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 4ea85a8bcb..8329af040b 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs @@ -43,7 +43,7 @@ using Caps=OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.CoreModules.Framework { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CapabilitiesModule")] public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7498cfe73e..3cb1901494 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -43,9 +43,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; using log4net; using Nini.Config; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EntityTransferModule")] public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index e37d4293c1..41ca13b8ea 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -42,9 +42,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; using log4net; using Nini.Config; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGEntityTransferModule")] public class HGEntityTransferModule : EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule { diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 6bb758ea07..964efdaa46 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -42,9 +42,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; using log4net; using Nini.Config; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGInventoryAccessModule")] public class HGInventoryAccessModule : BasicInventoryAccessModule, INonSharedRegionModule, IInventoryAccessModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8b34c286fc..8b7c16e1ca 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -46,9 +46,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; using log4net; using Nini.Config; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicInventoryAccessModule")] public class BasicInventoryAccessModule : INonSharedRegionModule, IInventoryAccessModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -180,12 +182,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) return; - InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId); - InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(f); - - if (folder == null || folder.Owner != remoteClient.AgentId) - return; - if (transactionID == UUID.Zero) { ScenePresence presence; diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index 3155ce7cc9..ec22146dbf 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs @@ -41,10 +41,12 @@ using OpenSim.Server.Base; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; namespace OpenSim.Region.CoreModules.Framework.Library { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LibraryModule")] public class LibraryModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index e4115851af..d84460a7a8 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs @@ -38,10 +38,12 @@ using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts; using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Framework.Monitoring { - public class MonitorModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MonitorModule")] + public class MonitorModule : INonSharedRegionModule { /// /// Is this module enabled? @@ -62,14 +64,14 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring private readonly List m_alerts = new List(); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - #region Implementation of IRegionModule - public MonitorModule() { Enabled = true; } - public void Initialise(Scene scene, IConfigSource source) + #region Implementation of INonSharedRegionModule + + public void Initialise(IConfigSource source) { IConfig cnfg = source.Configs["Monitoring"]; @@ -79,6 +81,13 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring if (!Enabled) return; + } + + public void AddRegion(Scene scene) + { + if (!Enabled) + return; + m_scene = scene; m_scene.AddCommand("General", this, "monitor report", @@ -89,101 +98,42 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage); MainServer.Instance.AddHTTPHandler( "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName), StatsPage); + + AddMonitors(); } - public void DebugMonitors(string module, string[] args) - { - foreach (IMonitor monitor in m_staticMonitors) - { - MainConsole.Instance.OutputFormat( - "[MONITOR MODULE]: {0} reports {1} = {2}", - m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue()); - } - - foreach (KeyValuePair tuple in m_scene.StatsReporter.GetExtraSimStats()) - { - MainConsole.Instance.OutputFormat( - "[MONITOR MODULE]: {0} reports {1} = {2}", - m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value); - } - } - - public void TestAlerts() - { - foreach (IAlert alert in m_alerts) - { - alert.Test(); - } - } - - public Hashtable StatsPage(Hashtable request) - { - // If request was for a specific monitor - // eg url/?monitor=Monitor.Name - if (request.ContainsKey("monitor")) - { - string monID = (string) request["monitor"]; - - foreach (IMonitor monitor in m_staticMonitors) - { - string elemName = monitor.ToString(); - if (elemName.StartsWith(monitor.GetType().Namespace)) - elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1); - - if (elemName == monID || monitor.ToString() == monID) - { - Hashtable ereply3 = new Hashtable(); - - ereply3["int_response_code"] = 404; // 200 OK - ereply3["str_response_string"] = monitor.GetValue().ToString(); - ereply3["content_type"] = "text/plain"; - - return ereply3; - } - } - - // FIXME: Arguably this should also be done with dynamic monitors but I'm not sure what the above code - // is even doing. Why are we inspecting the type of the monitor??? - - // No monitor with that name - Hashtable ereply2 = new Hashtable(); - - ereply2["int_response_code"] = 404; // 200 OK - ereply2["str_response_string"] = "No such monitor"; - ereply2["content_type"] = "text/plain"; - - return ereply2; - } - - string xml = ""; - foreach (IMonitor monitor in m_staticMonitors) - { - string elemName = monitor.GetName(); - xml += "<" + elemName + ">" + monitor.GetValue().ToString() + ""; -// m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue()); - } - - foreach (KeyValuePair tuple in m_scene.StatsReporter.GetExtraSimStats()) - { - xml += "<" + tuple.Key + ">" + tuple.Value + ""; - } - - xml += ""; - - Hashtable ereply = new Hashtable(); - - ereply["int_response_code"] = 200; // 200 OK - ereply["str_response_string"] = xml; - ereply["content_type"] = "text/xml"; - - return ereply; - } - - public void PostInitialise() + public void RemoveRegion(Scene scene) { if (!Enabled) return; + MainServer.Instance.RemoveHTTPHandler("GET", "/monitorstats/" + m_scene.RegionInfo.RegionID); + MainServer.Instance.RemoveHTTPHandler("GET", "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName)); + m_scene = null; + } + + public void Close() + { + } + + public string Name + { + get { return "Region Health Monitoring Module"; } + } + + public void RegionLoaded(Scene scene) + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion + + public void AddMonitors() + { m_staticMonitors.Add(new AgentCountMonitor(m_scene)); m_staticMonitors.Add(new ChildAgentCountMonitor(m_scene)); m_staticMonitors.Add(new GCMemoryMonitor()); @@ -196,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring m_staticMonitors.Add(new EventFrameMonitor(m_scene)); m_staticMonitors.Add(new LandFrameMonitor(m_scene)); m_staticMonitors.Add(new LastFrameTimeMonitor(m_scene)); - + m_staticMonitors.Add( new GenericMonitor( m_scene, @@ -357,25 +307,98 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring } } + public void DebugMonitors(string module, string[] args) + { + foreach (IMonitor monitor in m_staticMonitors) + { + MainConsole.Instance.OutputFormat( + "[MONITOR MODULE]: {0} reports {1} = {2}", + m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue()); + } + + foreach (KeyValuePair tuple in m_scene.StatsReporter.GetExtraSimStats()) + { + MainConsole.Instance.OutputFormat( + "[MONITOR MODULE]: {0} reports {1} = {2}", + m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value); + } + } + + public void TestAlerts() + { + foreach (IAlert alert in m_alerts) + { + alert.Test(); + } + } + + public Hashtable StatsPage(Hashtable request) + { + // If request was for a specific monitor + // eg url/?monitor=Monitor.Name + if (request.ContainsKey("monitor")) + { + string monID = (string) request["monitor"]; + + foreach (IMonitor monitor in m_staticMonitors) + { + string elemName = monitor.ToString(); + if (elemName.StartsWith(monitor.GetType().Namespace)) + elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1); + + if (elemName == monID || monitor.ToString() == monID) + { + Hashtable ereply3 = new Hashtable(); + + ereply3["int_response_code"] = 404; // 200 OK + ereply3["str_response_string"] = monitor.GetValue().ToString(); + ereply3["content_type"] = "text/plain"; + + return ereply3; + } + } + + // FIXME: Arguably this should also be done with dynamic monitors but I'm not sure what the above code + // is even doing. Why are we inspecting the type of the monitor??? + + // No monitor with that name + Hashtable ereply2 = new Hashtable(); + + ereply2["int_response_code"] = 404; // 200 OK + ereply2["str_response_string"] = "No such monitor"; + ereply2["content_type"] = "text/plain"; + + return ereply2; + } + + string xml = ""; + foreach (IMonitor monitor in m_staticMonitors) + { + string elemName = monitor.GetName(); + xml += "<" + elemName + ">" + monitor.GetValue().ToString() + ""; +// m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue()); + } + + foreach (KeyValuePair tuple in m_scene.StatsReporter.GetExtraSimStats()) + { + xml += "<" + tuple.Key + ">" + tuple.Value + ""; + } + + xml += ""; + + Hashtable ereply = new Hashtable(); + + ereply["int_response_code"] = 200; // 200 OK + ereply["str_response_string"] = xml; + ereply["content_type"] = "text/xml"; + + return ereply; + } + void OnTriggerAlert(System.Type reporter, string reason, bool fatal) { m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); } - - public void Close() - { - } - - public string Name - { - get { return "Region Health Monitoring Module"; } - } - - public bool IsSharedModule - { - get { return false; } - } - - #endregion + } } diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs index acefc97276..4ef57fe978 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs @@ -41,9 +41,11 @@ using OpenMetaverse; using OpenMetaverse.Packets; using log4net; using Nini.Config; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Framework.UserManagement { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGUserManagementModule")] public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index b4811dadce..86e70045e0 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -42,6 +42,7 @@ using OpenMetaverse; using OpenMetaverse.Packets; using log4net; using Nini.Config; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Framework.UserManagement { @@ -54,6 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement public Dictionary ServerURLs { get; set; } } + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserManagementModule")] public class UserManagementModule : ISharedRegionModule, IUserManagement { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index 0c60391fe2..e0921adf51 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs @@ -31,6 +31,7 @@ using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.CoreModules.World.WorldMap; using OpenSim.Region.Framework.Interfaces; @@ -39,6 +40,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Hypergrid { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGWorldMapModule")] public class HGWorldMapModule : WorldMapModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs deleted file mode 100644 index 2cc0a0797f..0000000000 --- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Reflection; -using System.Text; -using log4net; -using Nini.Config; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.CoreModules.InterGrid -{ - public class OGSRadmin : IRegionModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly List m_scenes = new List(); - private IConfigSource m_settings; - - #region Implementation of IRegionModuleBase - - public string Name - { - get { return "OGS Supporting RAdmin"; } - } - - - public void Initialise(IConfigSource source) - { - m_settings = source; - } - - public void Close() - { - - } - - public void AddRegion(Scene scene) - { - lock (m_scenes) - m_scenes.Add(scene); - } - - public void RemoveRegion(Scene scene) - { - lock (m_scenes) - m_scenes.Remove(scene); - } - - public void RegionLoaded(Scene scene) - { - - } - - public void PostInitialise() - { - if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) - { - MainServer.Instance.AddXmlRPCHandler("grid_message", GridWideMessage); - } - } - - #endregion - - #region IRegionModule - - public void Initialise(Scene scene, IConfigSource source) - { - m_settings = source; - - lock (m_scenes) - m_scenes.Add(scene); - } - - public bool IsSharedModule - { - get { return true; } - } - - #endregion - - public XmlRpcResponse GridWideMessage(XmlRpcRequest req, IPEndPoint remoteClient) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable responseData = new Hashtable(); - - Hashtable requestData = (Hashtable)req.Params[0]; - - // REFACTORING PROBLEM. This authorization needs to be replaced with some other - //if ((!requestData.Contains("password") || (string)requestData["password"] != m_com.NetworkServersInfo.GridRecvKey)) - //{ - // responseData["accepted"] = false; - // responseData["success"] = false; - // responseData["error"] = "Invalid Key"; - // response.Value = responseData; - // return response; - //} - - string message = (string)requestData["message"]; - string user = (string)requestData["user"]; - m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); - - lock (m_scenes) - foreach (Scene scene in m_scenes) - { - IDialogModule dialogModule = scene.RequestModuleInterface(); - if (dialogModule != null) - dialogModule.SendNotificationToUsersInRegion(UUID.Random(), user, message); - } - - responseData["accepted"] = true; - responseData["success"] = true; - response.Value = responseData; - - return response; - } - } -} diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs deleted file mode 100644 index 4a76b00467..0000000000 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ /dev/null @@ -1,1297 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.Security; -using System.Reflection; -using System.Security.Cryptography.X509Certificates; -using System.Threading; -using System.Web; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenSim.Framework; -using OpenSim.Framework.Capabilities; -using OpenSim.Framework.Monitoring; -using OpenSim.Framework.Servers; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using Caps=OpenSim.Framework.Capabilities.Caps; -using OSDArray=OpenMetaverse.StructuredData.OSDArray; -using OSDMap=OpenMetaverse.StructuredData.OSDMap; - -namespace OpenSim.Region.CoreModules.InterGrid -{ - public struct OGPState - { - public string first_name; - public string last_name; - public UUID agent_id; - public UUID local_agent_id; - public UUID region_id; - public uint circuit_code; - public UUID secure_session_id; - public UUID session_id; - public bool agent_access; - public string sim_access; - public uint god_level; - public bool god_overide; - public bool identified; - public bool transacted; - public bool age_verified; - public bool allow_redirect; - public int limited_to_estate; - public string inventory_host; - public bool src_can_see_mainland; - public int src_estate_id; - public int src_version; - public int src_parent_estate_id; - public bool visible_to_parent; - public string teleported_into_region; - } - - public class OpenGridProtocolModule : IRegionModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private List m_scene = new List(); - - private Dictionary CapsLoginID = new Dictionary(); - private Dictionary m_OGPState = new Dictionary(); - private Dictionary m_loginToRegionState = new Dictionary(); - - - private string LastNameSuffix = "_EXTERNAL"; - private string FirstNamePrefix = ""; - private string httpsCN = ""; - private bool httpSSL = false; - private uint httpsslport = 0; -// private bool GridMode = false; - - #region IRegionModule Members - - public void Initialise(Scene scene, IConfigSource config) - { - bool enabled = false; - IConfig cfg = null; - IConfig httpcfg = null; -// IConfig startupcfg = null; - try - { - cfg = config.Configs["OpenGridProtocol"]; - } catch (NullReferenceException) - { - enabled = false; - } - - try - { - httpcfg = config.Configs["Network"]; - } - catch (NullReferenceException) - { - - } -// try -// { -// startupcfg = config.Configs["Startup"]; -// } -// catch (NullReferenceException) -// { -// -// } - -// if (startupcfg != null) -// { -// GridMode = enabled = startupcfg.GetBoolean("gridmode", false); -// } - - if (cfg != null) - { - enabled = cfg.GetBoolean("ogp_enabled", false); - LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); - FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); - if (enabled) - { - m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); - lock (m_scene) - { - if (m_scene.Count == 0) - { - MainServer.Instance.AddLLSDHandler("/agent/", ProcessAgentDomainMessage); - MainServer.Instance.AddLLSDHandler("/", ProcessRegionDomainSeed); - try - { - ServicePointManager.ServerCertificateValidationCallback += customXertificateValidation; - } - catch (NotImplementedException) - { - try - { -#pragma warning disable 0612, 0618 - // Mono does not implement the ServicePointManager.ServerCertificateValidationCallback yet! Don't remove this! - ServicePointManager.CertificatePolicy = new MonoCert(); -#pragma warning restore 0612, 0618 - } - catch (Exception) - { - m_log.Error("[OGP]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); - } - } - - } - // 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) - { - if (m_scene.Count == 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)); - } - } - } - } - - public void PostInitialise() - { - } - - public void Close() - { - //scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - } - - public string Name - { - get { return "OpenGridProtocolModule"; } - } - - public bool IsSharedModule - { - get { return true; } - } - - #endregion - - public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) - { - string[] pathSegments = path.Split('/'); - - if (pathSegments.Length <= 1) - { - return GenerateNoHandlerMessage(); - - } - - return GenerateRezAvatarRequestMessage(pathSegments[1]); - - - - //m_log.InfoFormat("[OGP]: path {0}, segments {1} segment[1] {2} Last segment {3}", - // path, pathSegments.Length, pathSegments[1], pathSegments[pathSegments.Length - 1]); - //return new OSDMap(); - - } - - public OSD ProcessAgentDomainMessage(string path, OSD request, string endpoint) - { - // /agent/* - - string[] pathSegments = path.Split('/'); - if (pathSegments.Length <= 1) - { - return GenerateNoHandlerMessage(); - - } - if (pathSegments[0].Length == 0 && pathSegments[1].Length == 0) - { - return GenerateRezAvatarRequestMessage(""); - } - m_log.InfoFormat("[OGP]: path {0}, segments {1} segment[1] {2} Last segment {3}", - path, pathSegments.Length, pathSegments[1], pathSegments[pathSegments.Length - 1]); - - switch (pathSegments[pathSegments.Length - 1]) - { - case "rez_avatar": - return RezAvatarMethod(path, request); - //break; - case "derez_avatar": - return DerezAvatarMethod(path, request); - //break; - - } - if (path.Length < 2) - { - return GenerateNoHandlerMessage(); - } - - switch (pathSegments[pathSegments.Length - 2] + "/" + pathSegments[pathSegments.Length - 1]) - { - case "rez_avatar/rez": - return RezAvatarMethod(path, request); - //break; - case "rez_avatar/request": - return RequestRezAvatarMethod(path, request); - case "rez_avatar/place": - return RequestRezAvatarMethod(path, request); - case "rez_avatar/derez": - return DerezAvatarMethod(path, request); - //break; - default: - return GenerateNoHandlerMessage(); - } - //return null; - } - - private OSD GenerateRezAvatarRequestMessage(string regionname) - { - Scene region = null; - bool usedroot = false; - - if (regionname.Length == 0) - { - region = GetRootScene(); - usedroot = true; - } - else - { - region = GetScene(HttpUtility.UrlDecode(regionname).ToLower()); - } - - // this shouldn't happen since we don't listen for a region that is down.. but - // it might if the region was taken down or is in the middle of restarting - - if (region == null) - { - region = GetRootScene(); - usedroot = true; - } - - UUID statekeeper = UUID.Random(); - - - - - RegionInfo reg = region.RegionInfo; - - OSDMap responseMap = new OSDMap(); - string rezHttpProtocol = "http://"; - //string regionCapsHttpProtocol = "http://"; - string httpaddr = reg.ExternalHostName; - string urlport = reg.HttpPort.ToString(); - string requestpath = "/agent/" + statekeeper + "/rez_avatar/request"; - - if (!usedroot) - { - lock (m_loginToRegionState) - { - if (!m_loginToRegionState.ContainsKey(requestpath)) - { - m_loginToRegionState.Add(requestpath, region.RegionInfo.RegionName.ToLower()); - } - } - } - - if (httpSSL) - { - rezHttpProtocol = "https://"; - //regionCapsHttpProtocol = "https://"; - urlport = httpsslport.ToString(); - - if (httpsCN.Length > 0) - httpaddr = httpsCN; - } - - responseMap["connect"] = OSD.FromBoolean(true); - OSDMap capabilitiesMap = new OSDMap(); - capabilitiesMap["rez_avatar/request"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + requestpath); - responseMap["capabilities"] = capabilitiesMap; - - return responseMap; - } - - // Using OpenSim.Framework.Capabilities.Caps here one time.. - // so the long name is probably better then a using statement - public void OnRegisterCaps(UUID agentID, Caps caps) - { - /* If we ever want to register our own caps here.... - * - string capsBase = "/CAPS/" + caps.CapsObjectPath; - caps.RegisterHandler("CAPNAME", - new RestStreamHandler("POST", capsBase + CAPSPOSTFIX!, - delegate(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - return METHODHANDLER(request, path, param, - agentID, caps); - })); - - * - */ - } - - public OSD RequestRezAvatarMethod(string path, OSD request) - { - //m_log.Debug("[REQUESTREZAVATAR]: " + request.ToString()); - - OSDMap requestMap = (OSDMap)request; - - - Scene homeScene = null; - - lock (m_loginToRegionState) - { - if (m_loginToRegionState.ContainsKey(path)) - { - homeScene = GetScene(m_loginToRegionState[path]); - m_loginToRegionState.Remove(path); - - if (homeScene == null) - homeScene = GetRootScene(); - } - else - { - homeScene = GetRootScene(); - } - } - - // Homescene is still null, we must have no regions that are up - if (homeScene == null) - return GenerateNoHandlerMessage(); - - RegionInfo reg = homeScene.RegionInfo; - ulong regionhandle = GetOSCompatibleRegionHandle(reg); - //string RegionURI = reg.ServerURI; - //int RegionPort = (int)reg.HttpPort; - - UUID RemoteAgentID = requestMap["agent_id"].AsUUID(); - - // will be used in the future. The client always connects with the aditi agentid currently - UUID LocalAgentID = RemoteAgentID; - - string FirstName = requestMap["first_name"].AsString(); - string LastName = requestMap["last_name"].AsString(); - - FirstName = FirstNamePrefix + FirstName; - LastName = LastName + LastNameSuffix; - - OGPState userState = GetOGPState(LocalAgentID); - - userState.first_name = requestMap["first_name"].AsString(); - userState.last_name = requestMap["last_name"].AsString(); - userState.age_verified = requestMap["age_verified"].AsBoolean(); - userState.transacted = requestMap["transacted"].AsBoolean(); - userState.agent_access = requestMap["agent_access"].AsBoolean(); - userState.allow_redirect = requestMap["allow_redirect"].AsBoolean(); - userState.identified = requestMap["identified"].AsBoolean(); - userState.god_level = (uint)requestMap["god_level"].AsInteger(); - userState.sim_access = requestMap["sim_access"].AsString(); - userState.agent_id = RemoteAgentID; - userState.limited_to_estate = requestMap["limited_to_estate"].AsInteger(); - userState.src_can_see_mainland = requestMap["src_can_see_mainland"].AsBoolean(); - userState.src_estate_id = requestMap["src_estate_id"].AsInteger(); - userState.local_agent_id = LocalAgentID; - userState.teleported_into_region = reg.RegionName.ToLower(); - - UpdateOGPState(LocalAgentID, userState); - - OSDMap responseMap = new OSDMap(); - - if (RemoteAgentID == UUID.Zero) - { - responseMap["connect"] = OSD.FromBoolean(false); - responseMap["message"] = OSD.FromString("No agent ID was specified in rez_avatar/request"); - m_log.Error("[OGP]: rez_avatar/request failed because no avatar UUID was provided in the request body"); - return responseMap; - } - - responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName); - - // DEPRECATED - responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); - - responseMap["connect"] = OSD.FromBoolean(true); - responseMap["sim_port"] = OSD.FromInteger(reg.InternalEndPoint.Port); - responseMap["region_x"] = OSD.FromInteger(reg.RegionLocX * (uint)Constants.RegionSize); // LLX - responseMap["region_y"] = OSD.FromInteger(reg.RegionLocY * (uint)Constants.RegionSize); // LLY - responseMap["region_id"] = OSD.FromUUID(reg.originRegionID); - - if (reg.RegionSettings.Maturity == 1) - { - responseMap["sim_access"] = OSD.FromString("Mature"); - } - else if (reg.RegionSettings.Maturity == 2) - { - responseMap["sim_access"] = OSD.FromString("Adult"); - } - else - { - responseMap["sim_access"] = OSD.FromString("PG"); - } - - // Generate a dummy agent for the user so we can get back a CAPS path - AgentCircuitData agentData = new AgentCircuitData(); - agentData.AgentID = LocalAgentID; - agentData.BaseFolder = UUID.Zero; - agentData.CapsPath = CapsUtil.GetRandomCapsObjectPath(); - agentData.child = false; - agentData.circuitcode = (uint)(Util.RandomClass.Next()); - agentData.firstname = FirstName; - agentData.lastname = LastName; - agentData.SecureSessionID = UUID.Random(); - agentData.SessionID = UUID.Random(); - agentData.startpos = new Vector3(128f, 128f, 100f); - - // Pre-Fill our region cache with information on the agent. - UserAgentData useragent = new UserAgentData(); - useragent.AgentIP = "unknown"; - useragent.AgentOnline = true; - useragent.AgentPort = (uint)0; - useragent.Handle = regionhandle; - useragent.InitialRegion = reg.originRegionID; - useragent.LoginTime = Util.UnixTimeSinceEpoch(); - useragent.LogoutTime = 0; - useragent.Position = agentData.startpos; - useragent.Region = reg.originRegionID; - useragent.SecureSessionID = agentData.SecureSessionID; - useragent.SessionID = agentData.SessionID; - - UserProfileData userProfile = new UserProfileData(); - userProfile.AboutText = "OGP User"; - userProfile.CanDoMask = (uint)0; - userProfile.Created = Util.UnixTimeSinceEpoch(); - userProfile.CurrentAgent = useragent; - userProfile.CustomType = "OGP"; - userProfile.FirstLifeAboutText = "I'm testing OpenGrid Protocol"; - userProfile.FirstLifeImage = UUID.Zero; - userProfile.FirstName = agentData.firstname; - userProfile.GodLevel = 0; - userProfile.HomeLocation = agentData.startpos; - userProfile.HomeLocationX = agentData.startpos.X; - userProfile.HomeLocationY = agentData.startpos.Y; - userProfile.HomeLocationZ = agentData.startpos.Z; - userProfile.HomeLookAt = Vector3.Zero; - userProfile.HomeLookAtX = userProfile.HomeLookAt.X; - userProfile.HomeLookAtY = userProfile.HomeLookAt.Y; - userProfile.HomeLookAtZ = userProfile.HomeLookAt.Z; - userProfile.HomeRegion = reg.RegionHandle; - userProfile.HomeRegionID = reg.originRegionID; - userProfile.HomeRegionX = reg.RegionLocX; - userProfile.HomeRegionY = reg.RegionLocY; - userProfile.ID = agentData.AgentID; - userProfile.Image = UUID.Zero; - userProfile.LastLogin = Util.UnixTimeSinceEpoch(); - userProfile.Partner = UUID.Zero; - userProfile.PasswordHash = "$1$"; - userProfile.PasswordSalt = ""; - userProfile.SurName = agentData.lastname; - //userProfile.UserAssetURI = homeScene.CommsManager.NetworkServersInfo.AssetURL; - userProfile.UserFlags = 0; - //userProfile.UserInventoryURI = homeScene.CommsManager.NetworkServersInfo.InventoryURL; - userProfile.WantDoMask = 0; - userProfile.WebLoginKey = UUID.Random(); - - // !!! REFACTORING PROBLEM. This needs to be changed for 0.7 - // - //// Do caps registration - //// get seed capagentData.firstname = FirstName;agentData.lastname = LastName; - //if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode) - //{ - // homeScene.CommsManager.UserAdminService.AddUser( - // agentData.firstname, agentData.lastname, CreateRandomStr(7), "", - // homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID); - - // UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID); - // if (userProfile2 != null) - // { - // userProfile = userProfile2; - // userProfile.AboutText = "OGP USER"; - // userProfile.FirstLifeAboutText = "OGP USER"; - // homeScene.CommsManager.UserService.UpdateUserProfile(userProfile); - // } - //} - - //// Stick our data in the cache so the region will know something about us - //homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(userProfile); - - // Call 'new user' event handler - string reason; - if (!homeScene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) - { - responseMap["connect"] = OSD.FromBoolean(false); - responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason)); - m_log.ErrorFormat("[OGP]: rez_avatar/request failed: {0}", reason); - return responseMap; - } - - - //string raCap = string.Empty; - - UUID AvatarRezCapUUID = LocalAgentID; - string rezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/rez"; - string derezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/derez"; - // Get a reference to the user's cap so we can pull out the Caps Object Path - Caps userCap - = homeScene.CapsModule.GetCapsForUser(agentData.AgentID); - - string rezHttpProtocol = "http://"; - string regionCapsHttpProtocol = "http://"; - string httpaddr = reg.ExternalHostName; - string urlport = reg.HttpPort.ToString(); - - if (httpSSL) - { - rezHttpProtocol = "https://"; - regionCapsHttpProtocol = "https://"; - urlport = httpsslport.ToString(); - - if (httpsCN.Length > 0) - httpaddr = httpsCN; - } - - // DEPRECATED - responseMap["seed_capability"] - = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); - - // REPLACEMENT - responseMap["region_seed_capability"] - = OSD.FromString( - regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); - - responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); - responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); - responseMap["rez_avatar/derez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + derezAvatarPath); - - // Add the user to the list of CAPS that are outstanding. - // well allow the caps hosts in this dictionary - lock (CapsLoginID) - { - if (CapsLoginID.ContainsKey(rezAvatarPath)) - { - CapsLoginID[rezAvatarPath] = agentData; - - // This is a joke, if you didn't notice... It's so unlikely to happen, that I'll print this message if it does occur! - m_log.Error("[OGP]: Holy anomoly batman! Caps path already existed! All the UUID Duplication worries were founded!"); - } - else - { - CapsLoginID.Add(rezAvatarPath, agentData); - } - } - - //m_log.Debug("Response:" + responseMap.ToString()); - return responseMap; - } - - public OSD RezAvatarMethod(string path, OSD request) - { - m_log.WarnFormat("[REZAVATAR]: {0}", request.ToString()); - - OSDMap responseMap = new OSDMap(); - - AgentCircuitData userData = null; - - // Only people we've issued a cap can go further - if (TryGetAgentCircuitData(path,out userData)) - { - OSDMap requestMap = (OSDMap)request; - - // take these values to start. There's a few more - UUID SecureSessionID=requestMap["secure_session_id"].AsUUID(); - UUID SessionID = requestMap["session_id"].AsUUID(); - int circuitcode = requestMap["circuit_code"].AsInteger(); - OSDArray Parameter = new OSDArray(); - if (requestMap.ContainsKey("parameter")) - { - Parameter = (OSDArray)requestMap["parameter"]; - } - - //int version = 1; - int estateID = 1; - int parentEstateID = 1; - UUID regionID = UUID.Zero; - bool visibleToParent = true; - - for (int i = 0; i < Parameter.Count; i++) - { - OSDMap item = (OSDMap)Parameter[i]; -// if (item.ContainsKey("version")) -// { -// version = item["version"].AsInteger(); -// } - if (item.ContainsKey("estate_id")) - { - estateID = item["estate_id"].AsInteger(); - } - if (item.ContainsKey("parent_estate_id")) - { - parentEstateID = item["parent_estate_id"].AsInteger(); - - } - if (item.ContainsKey("region_id")) - { - regionID = item["region_id"].AsUUID(); - - } - if (item.ContainsKey("visible_to_parent")) - { - visibleToParent = item["visible_to_parent"].AsBoolean(); - } - } - //Update our Circuit data with the real values - userData.SecureSessionID = SecureSessionID; - userData.SessionID = SessionID; - - OGPState userState = GetOGPState(userData.AgentID); - - // Locate a home scene suitable for the user. - Scene homeScene = null; - - homeScene = GetScene(userState.teleported_into_region); - - if (homeScene == null) - homeScene = GetRootScene(); - - if (homeScene != null) - { - // Get a referenceokay - to their Cap object so we can pull out the capobjectroot - Caps userCap - = homeScene.CapsModule.GetCapsForUser(userData.AgentID); - - //Update the circuit data in the region so this user is authorized - homeScene.UpdateCircuitData(userData); - homeScene.ChangeCircuitCode(userData.circuitcode,(uint)circuitcode); - - // Load state - - - // Keep state changes - userState.first_name = requestMap["first_name"].AsString(); - userState.secure_session_id = requestMap["secure_session_id"].AsUUID(); - userState.age_verified = requestMap["age_verified"].AsBoolean(); - userState.region_id = homeScene.RegionInfo.originRegionID; // replace 0000000 with our regionid - userState.transacted = requestMap["transacted"].AsBoolean(); - userState.agent_access = requestMap["agent_access"].AsBoolean(); - userState.inventory_host = requestMap["inventory_host"].AsString(); - userState.identified = requestMap["identified"].AsBoolean(); - userState.session_id = requestMap["session_id"].AsUUID(); - userState.god_level = (uint)requestMap["god_level"].AsInteger(); - userState.last_name = requestMap["last_name"].AsString(); - userState.god_overide = requestMap["god_override"].AsBoolean(); - userState.circuit_code = (uint)requestMap["circuit_code"].AsInteger(); - userState.limited_to_estate = requestMap["limited_to_estate"].AsInteger(); - userState.src_estate_id = estateID; - userState.region_id = regionID; - userState.src_parent_estate_id = parentEstateID; - userState.visible_to_parent = visibleToParent; - - // Save state changes - UpdateOGPState(userData.AgentID, userState); - - // Get the region information for the home region. - RegionInfo reg = homeScene.RegionInfo; - - // Dummy positional and look at info.. we don't have it. - OSDArray PositionArray = new OSDArray(); - PositionArray.Add(OSD.FromInteger(128)); - PositionArray.Add(OSD.FromInteger(128)); - PositionArray.Add(OSD.FromInteger(40)); - - OSDArray LookAtArray = new OSDArray(); - LookAtArray.Add(OSD.FromInteger(1)); - LookAtArray.Add(OSD.FromInteger(1)); - LookAtArray.Add(OSD.FromInteger(1)); - - // Our region's X and Y position in OpenSimulator space. - uint fooX = reg.RegionLocX; - uint fooY = reg.RegionLocY; - m_log.InfoFormat("[OGP]: region x({0}) region y({1})", fooX, fooY); - m_log.InfoFormat("[OGP]: region http {0} {1}", reg.ServerURI, reg.HttpPort); - m_log.InfoFormat("[OGO]: region UUID {0} ", reg.RegionID); - - // Convert the X and Y position to LL space - responseMap["region_x"] = OSD.FromInteger(fooX * (uint)Constants.RegionSize); // convert it to LL X - responseMap["region_y"] = OSD.FromInteger(fooY * (uint)Constants.RegionSize); // convert it to LL Y - - // Give em a new seed capability - responseMap["seed_capability"] = OSD.FromString("http://" + reg.ExternalHostName + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/"); - responseMap["region"] = OSD.FromUUID(reg.originRegionID); - responseMap["look_at"] = LookAtArray; - - responseMap["sim_port"] = OSD.FromInteger(reg.InternalEndPoint.Port); - responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName);// + ":" + reg.InternalEndPoint.Port.ToString()); - - // DEPRECATED - responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); - - responseMap["session_id"] = OSD.FromUUID(SessionID); - responseMap["secure_session_id"] = OSD.FromUUID(SecureSessionID); - responseMap["circuit_code"] = OSD.FromInteger(circuitcode); - - responseMap["position"] = PositionArray; - - responseMap["region_id"] = OSD.FromUUID(reg.originRegionID); - - responseMap["sim_access"] = OSD.FromString("Mature"); - - responseMap["connect"] = OSD.FromBoolean(true); - - - - m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString()); - } - } - - return responseMap; - } - - public OSD DerezAvatarMethod(string path, OSD request) - { - m_log.ErrorFormat("DerezPath: {0}, Request: {1}", path, request.ToString()); - - //LLSD llsdResponse = null; - OSDMap responseMap = new OSDMap(); - - string[] PathArray = path.Split('/'); - m_log.InfoFormat("[OGP]: prefix {0}, uuid {1}, suffix {2}", PathArray[1], PathArray[2], PathArray[3]); - string uuidString = PathArray[2]; - m_log.InfoFormat("[OGP]: Request to Derez avatar with UUID {0}", uuidString); - UUID userUUID = UUID.Zero; - if (UUID.TryParse(uuidString, out userUUID)) - { - UUID RemoteID = (UUID)uuidString; - UUID LocalID = RemoteID; - // FIXME: TODO: Routine to map RemoteUUIDs to LocalUUIds - // would be done already.. but the client connects with the Aditi UUID - // regardless over the UDP stack - - OGPState userState = GetOGPState(LocalID); - if (userState.agent_id != UUID.Zero) - { - //OSDMap outboundRequestMap = new OSDMap(); - OSDMap inboundRequestMap = (OSDMap)request; - string rezAvatarString = inboundRequestMap["rez_avatar"].AsString(); - if (rezAvatarString.Length == 0) - { - rezAvatarString = inboundRequestMap["rez_avatar/rez"].AsString(); - } - OSDArray LookAtArray = new OSDArray(); - LookAtArray.Add(OSD.FromInteger(1)); - LookAtArray.Add(OSD.FromInteger(1)); - LookAtArray.Add(OSD.FromInteger(1)); - - OSDArray PositionArray = new OSDArray(); - PositionArray.Add(OSD.FromInteger(128)); - PositionArray.Add(OSD.FromInteger(128)); - PositionArray.Add(OSD.FromInteger(40)); - - OSDArray lookArray = new OSDArray(); - lookArray.Add(OSD.FromInteger(128)); - lookArray.Add(OSD.FromInteger(128)); - lookArray.Add(OSD.FromInteger(40)); - - responseMap["connect"] = OSD.FromBoolean(true);// it's okay to give this user up - responseMap["look_at"] = LookAtArray; - - m_log.WarnFormat("[OGP]: Invoking rez_avatar on host:{0} for avatar: {1} {2}", rezAvatarString, userState.first_name, userState.last_name); - - OSDMap rezResponseMap = invokeRezAvatarCap(responseMap, rezAvatarString,userState); - - // If invoking it returned an error, parse and end - if (rezResponseMap.ContainsKey("connect")) - { - if (rezResponseMap["connect"].AsBoolean() == false) - { - return responseMap; - } - } - - string rezRespSeedCap = ""; - - // DEPRECATED - if (rezResponseMap.ContainsKey("seed_capability")) - rezRespSeedCap = rezResponseMap["seed_capability"].AsString(); - - // REPLACEMENT - if (rezResponseMap.ContainsKey("region_seed_capability")) - rezRespSeedCap = rezResponseMap["region_seed_capability"].AsString(); - - // REPLACEMENT - if (rezResponseMap.ContainsKey("rez_avatar/rez")) - rezRespSeedCap = rezResponseMap["rez_avatar/rez"].AsString(); - - // DEPRECATED - string rezRespSim_ip = rezResponseMap["sim_ip"].AsString(); - - string rezRespSim_host = rezResponseMap["sim_host"].AsString(); - - int rrPort = rezResponseMap["sim_port"].AsInteger(); - int rrX = rezResponseMap["region_x"].AsInteger(); - int rrY = rezResponseMap["region_y"].AsInteger(); - m_log.ErrorFormat("X:{0}, Y:{1}", rrX, rrY); - UUID rrRID = rezResponseMap["region_id"].AsUUID(); - OSDArray RezResponsePositionArray = null; - string rrAccess = rezResponseMap["sim_access"].AsString(); - if (rezResponseMap.ContainsKey("position")) - { - RezResponsePositionArray = (OSDArray)rezResponseMap["position"]; - } - // DEPRECATED - responseMap["seed_capability"] = OSD.FromString(rezRespSeedCap); - - // REPLACEMENT r3 - responseMap["region_seed_capability"] = OSD.FromString(rezRespSeedCap); - - // DEPRECATED - responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString()); - - responseMap["sim_host"] = OSD.FromString(rezRespSim_host); - responseMap["sim_port"] = OSD.FromInteger(rrPort); - responseMap["region_x"] = OSD.FromInteger(rrX); - responseMap["region_y"] = OSD.FromInteger(rrY); - responseMap["region_id"] = OSD.FromUUID(rrRID); - responseMap["sim_access"] = OSD.FromString(rrAccess); - - if (RezResponsePositionArray != null) - { - responseMap["position"] = RezResponsePositionArray; - } - responseMap["look_at"] = lookArray; - responseMap["connect"] = OSD.FromBoolean(true); - - ShutdownConnection(LocalID,this); - // PLEASE STOP CHANGING THIS TO an M_LOG, M_LOG DOESN'T WORK ON MULTILINE .TOSTRINGS - Console.WriteLine("RESPONSEDEREZ: " + responseMap.ToString()); - return responseMap; - } - else - { - return GenerateNoStateMessage(LocalID); - } - } - else - { - return GenerateNoHandlerMessage(); - } - - //return responseMap; - } - - private OSDMap invokeRezAvatarCap(OSDMap responseMap, string CapAddress, OGPState userState) - { - Scene reg = GetRootScene(); - - WebRequest DeRezRequest = WebRequest.Create(CapAddress); - DeRezRequest.Method = "POST"; - DeRezRequest.ContentType = "application/xml+llsd"; - - OSDMap RAMap = new OSDMap(); - OSDMap AgentParms = new OSDMap(); - OSDMap RegionParms = new OSDMap(); - - OSDArray Parameter = new OSDArray(2); - - OSDMap version = new OSDMap(); - version["version"] = OSD.FromInteger(userState.src_version); - Parameter.Add(version); - - OSDMap SrcData = new OSDMap(); - SrcData["estate_id"] = OSD.FromInteger(reg.RegionInfo.EstateSettings.EstateID); - SrcData["parent_estate_id"] = OSD.FromInteger((reg.RegionInfo.EstateSettings.ParentEstateID == 100 ? 1 : reg.RegionInfo.EstateSettings.ParentEstateID)); - SrcData["region_id"] = OSD.FromUUID(reg.RegionInfo.originRegionID); - SrcData["visible_to_parent"] = OSD.FromBoolean(userState.visible_to_parent); - Parameter.Add(SrcData); - - AgentParms["first_name"] = OSD.FromString(userState.first_name); - AgentParms["last_name"] = OSD.FromString(userState.last_name); - AgentParms["agent_id"] = OSD.FromUUID(userState.agent_id); - RegionParms["region_id"] = OSD.FromUUID(userState.region_id); - AgentParms["circuit_code"] = OSD.FromInteger(userState.circuit_code); - AgentParms["secure_session_id"] = OSD.FromUUID(userState.secure_session_id); - AgentParms["session_id"] = OSD.FromUUID(userState.session_id); - AgentParms["agent_access"] = OSD.FromBoolean(userState.agent_access); - AgentParms["god_level"] = OSD.FromInteger(userState.god_level); - AgentParms["god_overide"] = OSD.FromBoolean(userState.god_overide); - AgentParms["identified"] = OSD.FromBoolean(userState.identified); - AgentParms["transacted"] = OSD.FromBoolean(userState.transacted); - AgentParms["age_verified"] = OSD.FromBoolean(userState.age_verified); - AgentParms["limited_to_estate"] = OSD.FromInteger(userState.limited_to_estate); - AgentParms["inventory_host"] = OSD.FromString(userState.inventory_host); - - // version 1 - RAMap = AgentParms; - - // Planned for version 2 - // RAMap["agent_params"] = AgentParms; - - RAMap["region_params"] = RegionParms; - RAMap["parameter"] = Parameter; - - string RAMapString = RAMap.ToString(); - m_log.InfoFormat("[OGP] RAMap string {0}", RAMapString); - OSD LLSDofRAMap = RAMap; // RENAME if this works - - m_log.InfoFormat("[OGP]: LLSD of map as string was {0}", LLSDofRAMap.ToString()); - //m_log.InfoFormat("[OGP]: LLSD+XML: {0}", LLSDParser.SerializeXmlString(LLSDofRAMap)); - byte[] buffer = OSDParser.SerializeLLSDXmlBytes(LLSDofRAMap); - - //string bufferDump = System.Text.Encoding.ASCII.GetString(buffer); - //m_log.InfoFormat("[OGP]: buffer form is {0}",bufferDump); - //m_log.InfoFormat("[OGP]: LLSD of map was {0}",buffer.Length); - - Stream os = null; - try - { // send the Post - DeRezRequest.ContentLength = buffer.Length; //Count bytes to send - os = DeRezRequest.GetRequestStream(); - os.Write(buffer, 0, buffer.Length); //Send it - os.Close(); - m_log.InfoFormat("[OGP]: Derez Avatar Posted Rez Avatar request to remote sim {0}", CapAddress); - } - catch (WebException ex) - { - m_log.InfoFormat("[OGP] Bad send on de_rez_avatar {0}", ex.Message); - responseMap["connect"] = OSD.FromBoolean(false); - - return responseMap; - } - - m_log.Info("[OGP] waiting for a reply after rez avatar send"); - string rez_avatar_reply = null; - { // get the response - try - { - WebResponse webResponse = DeRezRequest.GetResponse(); - if (webResponse == null) - { - m_log.Info("[OGP:] Null reply on rez_avatar post"); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - rez_avatar_reply = sr.ReadToEnd().Trim(); - m_log.InfoFormat("[OGP]: rez_avatar reply was {0} ", rez_avatar_reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[OGP]: exception on read after send of rez avatar {0}", ex.Message); - responseMap["connect"] = OSD.FromBoolean(false); - - return responseMap; - } - OSD rezResponse = null; - try - { - rezResponse = OSDParser.DeserializeLLSDXml(rez_avatar_reply); - - responseMap = (OSDMap)rezResponse; - } - catch (Exception ex) - { - m_log.InfoFormat("[OGP]: exception on parse of rez reply {0}", ex.Message); - responseMap["connect"] = OSD.FromBoolean(false); - - return responseMap; - } - } - return responseMap; - } - - public OSD GenerateNoHandlerMessage() - { - OSDMap map = new OSDMap(); - map["reason"] = OSD.FromString("LLSDRequest"); - map["message"] = OSD.FromString("No handler registered for LLSD Requests"); - map["login"] = OSD.FromString("false"); - map["connect"] = OSD.FromString("false"); - return map; - } - public OSD GenerateNoStateMessage(UUID passedAvatar) - { - OSDMap map = new OSDMap(); - map["reason"] = OSD.FromString("derez failed"); - map["message"] = OSD.FromString("Unable to locate OGP state for avatar " + passedAvatar.ToString()); - map["login"] = OSD.FromString("false"); - map["connect"] = OSD.FromString("false"); - return map; - } - private bool TryGetAgentCircuitData(string path, out AgentCircuitData userdata) - { - userdata = null; - lock (CapsLoginID) - { - if (CapsLoginID.ContainsKey(path)) - { - userdata = CapsLoginID[path]; - DiscardUsedCap(path); - return true; - } - } - return false; - } - - private void DiscardUsedCap(string path) - { - CapsLoginID.Remove(path); - } - - private Scene GetRootScene() - { - Scene ReturnScene = null; - lock (m_scene) - { - if (m_scene.Count > 0) - { - ReturnScene = m_scene[0]; - } - } - - return ReturnScene; - } - - private Scene GetScene(string scenename) - { - Scene ReturnScene = null; - lock (m_scene) - { - foreach (Scene s in m_scene) - { - if (s.RegionInfo.RegionName.ToLower() == scenename) - { - ReturnScene = s; - break; - } - } - } - - return ReturnScene; - } - - private ulong GetOSCompatibleRegionHandle(RegionInfo reg) - { - return Util.UIntsToLong(reg.RegionLocX, reg.RegionLocY); - } - - private OGPState InitializeNewState() - { - OGPState returnState = new OGPState(); - returnState.first_name = ""; - returnState.last_name = ""; - returnState.agent_id = UUID.Zero; - returnState.local_agent_id = UUID.Zero; - returnState.region_id = UUID.Zero; - returnState.circuit_code = 0; - returnState.secure_session_id = UUID.Zero; - returnState.session_id = UUID.Zero; - returnState.agent_access = true; - returnState.god_level = 0; - returnState.god_overide = false; - returnState.identified = false; - returnState.transacted = false; - returnState.age_verified = false; - returnState.limited_to_estate = 1; - returnState.inventory_host = "http://inv4.mysql.aditi.lindenlab.com"; - returnState.allow_redirect = true; - returnState.sim_access = ""; - returnState.src_can_see_mainland = true; - returnState.src_estate_id = 1; - returnState.src_version = 1; - returnState.src_parent_estate_id = 1; - returnState.visible_to_parent = true; - returnState.teleported_into_region = ""; - - return returnState; - } - - private OGPState GetOGPState(UUID agentId) - { - lock (m_OGPState) - { - if (m_OGPState.ContainsKey(agentId)) - { - return m_OGPState[agentId]; - } - else - { - return InitializeNewState(); - } - } - } - - public void DeleteOGPState(UUID agentId) - { - lock (m_OGPState) - { - if (m_OGPState.ContainsKey(agentId)) - m_OGPState.Remove(agentId); - } - } - - private void UpdateOGPState(UUID agentId, OGPState state) - { - lock (m_OGPState) - { - if (m_OGPState.ContainsKey(agentId)) - { - m_OGPState[agentId] = state; - } - else - { - m_OGPState.Add(agentId,state); - } - } - } - private bool SceneListDuplicateCheck(string str) - { - // no lock, called from locked space! - bool found = false; - - foreach (Scene s in m_scene) - { - if (s.RegionInfo.RegionName == str) - { - found = true; - break; - } - } - - return found; - } - - public void ShutdownConnection(UUID avatarId, OpenGridProtocolModule mod) - { - Scene homeScene = GetRootScene(); - ScenePresence avatar = null; - if (homeScene.TryGetScenePresence(avatarId,out avatar)) - { - KillAUser ku = new KillAUser(avatar,mod); - Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true); - } - } - -// private string CreateRandomStr(int len) -// { -// Random rnd = new Random(Environment.TickCount); -// string returnstring = ""; -// string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; -// -// for (int i = 0; i < len; i++) -// { -// returnstring += chars.Substring(rnd.Next(chars.Length), 1); -// } -// return returnstring; -// } - - // Temporary hack to allow teleporting to and from Vaak - private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) - { - //if (cert.Subject == "E=root@lindenlab.com, CN=*.vaak.lindenlab.com, O=\"Linden Lab, Inc.\", L=San Francisco, S=California, C=US") - //{ - return true; - //} - - //return false; - } - } - - public class KillAUser - { - private ScenePresence avToBeKilled = null; - private OpenGridProtocolModule m_mod = null; - - public KillAUser(ScenePresence avatar, OpenGridProtocolModule mod) - { - avToBeKilled = avatar; - m_mod = mod; - } - - public void ShutdownNoLogout() - { - UUID avUUID = UUID.Zero; - - if (avToBeKilled != null) - { - avUUID = avToBeKilled.UUID; - avToBeKilled.MakeChildAgent(); - - avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false; - - int sleepMS = 30000; - while (sleepMS > 0) - { - Watchdog.UpdateThread(); - Thread.Sleep(1000); - sleepMS -= 1000; - } - - // test for child agent because they might have come back - if (avToBeKilled.IsChildAgent) - { - m_mod.DeleteOGPState(avUUID); - avToBeKilled.ControllingClient.Close(); - } - } - - Watchdog.RemoveThread(); - } - - } - - public class MonoCert : ICertificatePolicy - { - #region ICertificatePolicy Members - - public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) - { - return true; - } - - #endregion - } -} diff --git a/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs b/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..5b8898bee6 --- /dev/null +++ b/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs @@ -0,0 +1,38 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Mono.Addins; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Region.CoreModules")] +[assembly: AssemblyDescription("Core modules for OpenSim")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.Region.CoreModules.Properties")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("94f62dd1-bcf3-4218-9844-9a3996286e3e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: Addin("OpenSim.Region.CoreModules", "0.1")] +[assembly: AddinDependency("OpenSim", "0.5")] + diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml deleted file mode 100644 index 6c73d911e0..0000000000 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ - \ - \ - \ - \ - - \ - \ - - - - - - - - - diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 93a045eff7..9d77b19f7f 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -37,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using log4net; using System.Reflection; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture { - public class DynamicTextureModule : IRegionModule, IDynamicTextureManager + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DynamicTextureModule")] + public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -81,6 +83,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture /// private Cache m_reuseableDynamicTextures; + /// + /// This constructor is only here because of the Unit Tests... + /// Don't use it. + /// + public DynamicTextureModule() + { + m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); + m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); + } + #region IDynamicTextureManager Members public void RegisterRender(string handleType, IDynamicTextureRender render) @@ -323,17 +335,30 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture #endregion - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { IConfig texturesConfig = config.Configs["Textures"]; if (texturesConfig != null) { ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false); ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false); - } + if (ReuseTextures) + { + m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); + m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); + } + } + } + + public void PostInitialise() + { + } + + public void AddRegion(Scene scene) + { if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) { RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); @@ -341,13 +366,14 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture } } - public void PostInitialise() + public void RegionLoaded(Scene scene) { - if (ReuseTextures) - { - m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); - m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); - } + } + + public void RemoveRegion(Scene scene) + { + if (RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) + RegisteredScenes.Remove(scene.RegionInfo.RegionID); } public void Close() @@ -359,9 +385,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture get { return "DynamicTextureModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index e91e8b9f45..d943b20a2a 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs @@ -37,10 +37,12 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Scripting.EmailModules { - public class EmailModule : IRegionModule, IEmailModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EmailModule")] + public class EmailModule : ISharedRegionModule, IEmailModule { // // Log @@ -72,31 +74,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules private bool m_Enabled = false; - public void InsertEmail(UUID to, Email email) - { - // It's tempting to create the queue here. Don't; objects which have - // not yet called GetNextEmail should have no queue, and emails to them - // should be silently dropped. + #region ISharedRegionModule - lock (m_MailQueues) - { - if (m_MailQueues.ContainsKey(to)) - { - if (m_MailQueues[to].Count >= m_MaxQueueSize) - { - // fail silently - return; - } - - lock (m_MailQueues[to]) - { - m_MailQueues[to].Add(email); - } - } - } - } - - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { m_Config = config; IConfig SMTPConfig; @@ -129,36 +109,44 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); - m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); + m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); } catch (Exception e) { - m_log.Error("[EMAIL] DefaultEmailModule not configured: "+ e.Message); + m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message); m_Enabled = false; return; } - // It's a go! - if (m_Enabled) + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + // It's a go! + lock (m_Scenes) { - lock (m_Scenes) + // Claim the interface slot + scene.RegisterModuleInterface(this); + + // Add to scene list + if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) { - // Claim the interface slot - scene.RegisterModuleInterface(this); - - // Add to scene list - if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) - { - m_Scenes[scene.RegionInfo.RegionHandle] = scene; - } - else - { - m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); - } + m_Scenes[scene.RegionInfo.RegionHandle] = scene; + } + else + { + m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); } - - m_log.Info("[EMAIL] Activated DefaultEmailModule"); } + + m_log.Info("[EMAIL] Activated DefaultEmailModule"); + } + + public void RemoveRegion(Scene scene) + { } public void PostInitialise() @@ -174,9 +162,39 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules get { return "DefaultEmailModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } + } + + public void RegionLoaded(Scene scene) + { + } + + #endregion + + public void InsertEmail(UUID to, Email email) + { + // It's tempting to create the queue here. Don't; objects which have + // not yet called GetNextEmail should have no queue, and emails to them + // should be silently dropped. + + lock (m_MailQueues) + { + if (m_MailQueues.ContainsKey(to)) + { + if (m_MailQueues[to].Count >= m_MaxQueueSize) + { + // fail silently + return; + } + + lock (m_MailQueues[to]) + { + m_MailQueues[to].Add(email); + } + } + } } private bool IsLocal(UUID objectID) diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index d328eb37dc..a676971a28 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -41,6 +41,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using Mono.Addins; /***************************************************** * @@ -87,7 +88,8 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { - public class HttpRequestModule : IRegionModule, IHttpRequestModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HttpRequestModule")] + public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule { private object HttpListLock = new object(); private int httpTimeout = 30000; @@ -270,24 +272,38 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest #endregion - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; - - m_scene.RegisterModuleInterface(this); - m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); m_pendingRequests = new Dictionary(); } + public void AddRegion(Scene scene) + { + m_scene = scene; + + m_scene.RegisterModuleInterface(this); + } + + public void RemoveRegion(Scene scene) + { + scene.UnregisterModuleInterface(this); + if (scene == m_scene) + m_scene = null; + } + public void PostInitialise() { } + public void RegionLoaded(Scene scene) + { + } + public void Close() { } @@ -297,9 +313,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest get { return m_name; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 53a9679580..a654477a3e 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Collections; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -94,6 +95,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp /// /// This module provides external URLs for in-world scripts. /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UrlModule")] public class UrlModule : ISharedRegionModule, IUrlModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 45e652788a..65737fa693 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -37,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using log4net; using System.Reflection; +using Mono.Addins; namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL { - public class LoadImageURLModule : IRegionModule, IDynamicTextureRender + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LoadImageURLModule")] + public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -104,22 +106,32 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL #endregion - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - if (m_scene == null) - { - m_scene = scene; - } - m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); } public void PostInitialise() { - if (m_scene != null) + } + + public void AddRegion(Scene scene) + { + if (m_scene == null) + m_scene = scene; + + } + + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) + { + if (m_textureManager == null && m_scene == scene) { m_textureManager = m_scene.RequestModuleInterface(); if (m_textureManager != null) @@ -138,9 +150,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL get { return m_name; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion @@ -172,6 +184,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL private void HttpRequestReturn(IAsyncResult result) { + if (m_textureManager == null) + { + m_log.WarnFormat("[LOADIMAGEURLMODULE]: No texture manager. Can't function."); + return; + } + RequestState state = (RequestState) result.AsyncState; WebRequest request = (WebRequest) state.Request; Stream stream = null; diff --git a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index dc54c3f821..f6e1d393a8 100644 --- a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -38,7 +38,7 @@ using OpenMetaverse; using System.Linq; using System.Linq.Expressions; -namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms +namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index a85540fbd9..a3a832fad5 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -40,12 +40,14 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using log4net; using System.Reflection; +using Mono.Addins; //using Cairo; namespace OpenSim.Region.CoreModules.Scripting.VectorRender { - public class VectorRenderModule : IRegionModule, IDynamicTextureRender + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VectorRenderModule")] + public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender { // These fields exist for testing purposes, please do not remove. // private static bool s_flipper; @@ -56,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender private Scene m_scene; private IDynamicTextureManager m_textureManager; + private Graphics m_graph; private string m_fontName = "Arial"; @@ -103,6 +106,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender public bool AsyncConvertData(UUID id, string bodyData, string extraParams) { + if (m_textureManager == null) + { + m_log.Warn("[VECTORRENDERMODULE]: No texture manager. Can't function"); + return false; + } // XXX: This isn't actually being done asynchronously! m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); @@ -131,45 +139,49 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender #endregion - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - if (m_scene == null) - { - m_scene = scene; - } - - if (m_graph == null) - { - // We won't dispose of these explicitly since this module is only removed when the entire simulator - // is shut down. - Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); - m_graph = Graphics.FromImage(bitmap); - } - IConfig cfg = config.Configs["VectorRender"]; if (null != cfg) { m_fontName = cfg.GetString("font_name", m_fontName); } m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); + + // We won't dispose of these explicitly since this module is only removed when the entire simulator + // is shut down. + Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); + m_graph = Graphics.FromImage(bitmap); } public void PostInitialise() { - m_textureManager = m_scene.RequestModuleInterface(); - if (m_textureManager != null) + } + + public void AddRegion(Scene scene) + { + if (m_scene == null) { - m_textureManager.RegisterRender(GetContentType(), this); + m_scene = scene; } + } - // This code exists for testing purposes, please do not remove. -// s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data; -// s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data; + public void RegionLoaded(Scene scene) + { + if (m_textureManager == null && m_scene == scene) + { + m_textureManager = m_scene.RequestModuleInterface(); + if (m_textureManager != null) + { + m_textureManager.RegisterRender(GetContentType(), this); + } + } + } - // Terrain dirt - smallest bin/assets file (6004 bytes) -// s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data; + public void RemoveRegion(Scene scene) + { } public void Close() @@ -181,9 +193,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender get { return "VectorRenderModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 401ff6cdef..2c2c99caa6 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -29,8 +29,12 @@ using System; 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; using OpenSim.Region.Framework.Scenes; @@ -86,7 +90,8 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.WorldComm { - public class WorldCommModule : IRegionModule, IWorldComm + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldCommModule")] + public class WorldCommModule : IWorldComm, INonSharedRegionModule { // private static readonly ILog m_log = // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -99,9 +104,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. @@ -109,23 +114,23 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm int maxhandles = 64; try { - m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); - m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); - m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); - maxlisteners = config.Configs["LL-Functions"].GetInt("max_listens_per_region", maxlisteners); - maxhandles = config.Configs["LL-Functions"].GetInt("max_listens_per_script", maxhandles); + m_whisperdistance = config.Configs["Chat"].GetInt( + "whisper_distance", m_whisperdistance); + m_saydistance = config.Configs["Chat"].GetInt( + "say_distance", m_saydistance); + m_shoutdistance = config.Configs["Chat"].GetInt( + "shout_distance", m_shoutdistance); + maxlisteners = config.Configs["LL-Functions"].GetInt( + "max_listens_per_region", maxlisteners); + maxhandles = config.Configs["LL-Functions"].GetInt( + "max_listens_per_script", maxhandles); } catch (Exception) { } if (maxlisteners < 1) maxlisteners = int.MaxValue; if (maxhandles < 1) maxhandles = int.MaxValue; - - 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); } @@ -134,6 +139,26 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm { } + public void AddRegion(Scene scene) + { + m_scene = scene; + m_scene.RegisterModuleInterface(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(this); + m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage; + m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage; + } + public void Close() { } @@ -143,10 +168,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm get { return "WorldCommModule"; } } - public bool IsSharedModule - { - get { return false; } - } + public Type ReplaceableInterface { get { return null; } } #endregion @@ -255,7 +277,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm if ((source = m_scene.GetSceneObjectPart(id)) != null) position = source.AbsolutePosition; - else if ((avatar = m_scene.GetScenePresence(id)) != null) + else if ((avatar = m_scene.GetScenePresence(id)) != null) position = avatar.AbsolutePosition; else if (ChatTypeEnum.Region == type) position = CenterOfRegion; @@ -278,7 +300,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm /// name of sender (object or avatar) /// key of sender (object or avatar) /// msg to sent - public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position) + public void DeliverMessage(ChatTypeEnum type, int channel, + string name, UUID id, string msg, Vector3 position) { // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", // type, channel, name, id, msg); @@ -286,17 +309,21 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm // Determine which listen event filters match the given set of arguments, this results // in a limited set of listeners, each belonging a host. If the host is in range, add them // to the pending queue. - foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) + foreach (ListenerInfo li + in m_listenerManager.GetListeners(UUID.Zero, channel, + name, id, msg)) { // Dont process if this message is from yourself! if (li.GetHostID().Equals(id)) continue; - SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); + SceneObjectPart sPart = m_scene.GetSceneObjectPart( + li.GetHostID()); if (sPart == null) continue; - double dis = Util.GetDistanceTo(sPart.AbsolutePosition, position); + double dis = Util.GetDistanceTo(sPart.AbsolutePosition, + position); switch (type) { case ChatTypeEnum.Whisper: @@ -339,14 +366,16 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm /// /// Message. /// - public void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg) + public void DeliverMessageTo(UUID target, int channel, Vector3 pos, + string name, UUID id, string msg) { // Is id an avatar? ScenePresence sp = m_scene.GetScenePresence(target); if (sp != null) { - // ignore if a child agent this is restricted to inside one region + // ignore if a child agent this is restricted to inside one + // region if (sp.IsChildAgent) return; @@ -355,8 +384,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm // non zero channel messages only go to the attachments if (channel == 0) { - m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), pos, name, id, false); - } + m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), + pos, name, id, false); + } else { List attachments = sp.GetAttachments(); @@ -372,13 +402,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm } // Need to check each attachment - foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) + foreach (ListenerInfo li + in m_listenerManager.GetListeners(UUID.Zero, + channel, name, id, msg)) { if (li.GetHostID().Equals(id)) continue; - if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) + if (m_scene.GetSceneObjectPart( + li.GetHostID()) == null) + { continue; + } if (targets.Contains(li.GetHostID())) QueueMessage(new ListenerInfo(li, name, id, msg)); @@ -389,17 +424,20 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm } // No avatar found so look for an object - foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) + foreach (ListenerInfo li + in m_listenerManager.GetListeners(UUID.Zero, channel, + name, id, msg)) { // Dont process if this message is from yourself! if (li.GetHostID().Equals(id)) continue; - SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); + SceneObjectPart sPart = m_scene.GetSceneObjectPart( + li.GetHostID()); if (sPart == null) continue; - if ( li.GetHostID().Equals(target)) + if (li.GetHostID().Equals(target)) { QueueMessage(new ListenerInfo(li, name, id, msg)); break; @@ -453,9 +491,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm private void DeliverClientMessage(Object sender, OSChatMessage e) { if (null != e.Sender) - DeliverMessage(e.Type, e.Channel, e.Sender.Name, e.Sender.AgentId, e.Message, e.Position); + { + DeliverMessage(e.Type, e.Channel, e.Sender.Name, + e.Sender.AgentId, e.Message, e.Position); + } else - DeliverMessage(e.Type, e.Channel, e.From, UUID.Zero, e.Message, e.Position); + { + DeliverMessage(e.Type, e.Channel, e.From, UUID.Zero, + e.Message, e.Position); + } } public Object[] GetSerializationData(UUID itemID) @@ -472,7 +516,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm public class ListenerManager { - private Dictionary> m_listeners = new Dictionary>(); + private Dictionary> m_listeners = + new Dictionary>(); private int m_maxlisteners; private int m_maxhandles; private int m_curlisteners; @@ -530,14 +575,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm itemID, hostID, channel, name, id, msg, regexBitfield); - List listeners; - if (!m_listeners.TryGetValue(channel,out listeners)) - { - listeners = new List(); - m_listeners.Add(channel, listeners); - } - listeners.Add(li); - m_curlisteners++; + List listeners; + if (!m_listeners.TryGetValue( + channel, out listeners)) + { + listeners = new List(); + m_listeners.Add(channel, listeners); + } + listeners.Add(li); + m_curlisteners++; return newHandle; } @@ -550,11 +596,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm { lock (m_listeners) { - foreach (KeyValuePair> lis in m_listeners) + foreach (KeyValuePair> lis + in m_listeners) { foreach (ListenerInfo li in lis.Value) { - if (li.GetItemID().Equals(itemID) && li.GetHandle().Equals(handle)) + if (li.GetItemID().Equals(itemID) && + li.GetHandle().Equals(handle)) { lis.Value.Remove(li); if (lis.Value.Count == 0) @@ -577,13 +625,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm lock (m_listeners) { - foreach (KeyValuePair> lis in m_listeners) + foreach (KeyValuePair> lis + in m_listeners) { foreach (ListenerInfo li in lis.Value) { if (li.GetItemID().Equals(itemID)) { - // store them first, else the enumerated bails on us + // store them first, else the enumerated bails on + // us removedListeners.Add(li); } } @@ -610,11 +660,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm { lock (m_listeners) { - foreach (KeyValuePair> lis in m_listeners) + foreach (KeyValuePair> lis + in m_listeners) { foreach (ListenerInfo li in lis.Value) { - if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) + if (li.GetItemID().Equals(itemID) && + li.GetHandle() == handle) { li.Activate(); // only one, bail out @@ -629,11 +681,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm { lock (m_listeners) { - foreach (KeyValuePair> lis in m_listeners) + foreach (KeyValuePair> lis + in m_listeners) { foreach (ListenerInfo li in lis.Value) { - if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) + if (li.GetItemID().Equals(itemID) && + li.GetHandle() == handle) { li.Deactivate(); // only one, bail out @@ -644,19 +698,24 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm } } - // non-locked access, since its always called in the context of the lock + /// + /// non-locked access, since its always called in the context of the + /// lock + /// + /// + /// private int GetNewHandle(UUID itemID) { List handles = new List(); // build a list of used keys for this specific itemID... - foreach (KeyValuePair> lis in m_listeners) + foreach (KeyValuePair> lis in m_listeners) { - foreach (ListenerInfo li in lis.Value) - { - if (li.GetItemID().Equals(itemID)) - handles.Add(li.GetHandle()); - } + foreach (ListenerInfo li in lis.Value) + { + if (li.GetItemID().Equals(itemID)) + handles.Add(li.GetHandle()); + } } // Note: 0 is NOT a valid handle for llListen() to return @@ -685,17 +744,30 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm #endregion - // Theres probably a more clever and efficient way to - // do this, maybe with regex. - // PM2008: Ha, one could even be smart and define a specialized Enumerator. - public List GetListeners(UUID itemID, int channel, string name, UUID id, string msg) + /// + /// Get listeners matching the input parameters. + /// + /// + /// Theres probably a more clever and efficient way to do this, maybe + /// with regex. + /// PM2008: Ha, one could even be smart and define a specialized + /// Enumerator. + /// + /// + /// + /// + /// + /// + /// + public List GetListeners(UUID itemID, int channel, + string name, UUID id, string msg) { List collection = new List(); lock (m_listeners) { List listeners; - if (!m_listeners.TryGetValue(channel,out listeners)) + if (!m_listeners.TryGetValue(channel, out listeners)) { return collection; } @@ -706,7 +778,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm { continue; } - if (!itemID.Equals(UUID.Zero) && !li.GetItemID().Equals(itemID)) + if (!itemID.Equals(UUID.Zero) && + !li.GetItemID().Equals(itemID)) { continue; } @@ -771,28 +844,68 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm lock (m_listeners) { if (!m_listeners.ContainsKey((int)item[2])) - m_listeners.Add((int)item[2], new List()); + { + m_listeners.Add((int)item[2], + new List()); + } m_listeners[(int)item[2]].Add(info); } - idx+=dataItemLength; + idx += dataItemLength; } } } public class ListenerInfo : IWorldCommListenerInfo { - private bool m_active; // Listener is active or not - private int m_handle; // Assigned handle of this listener - private uint m_localID; // Local ID from script engine - private UUID m_itemID; // ID of the host script engine - private UUID m_hostID; // ID of the host/scene part - private int m_channel; // Channel - private UUID m_id; // ID to filter messages from - private string m_name; // Object name to filter messages from - private string m_message; // The message + /// + /// Listener is active or not + /// + private bool m_active; - public ListenerInfo(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message) + /// + /// Assigned handle of this listener + /// + private int m_handle; + + /// + /// Local ID from script engine + /// + private uint m_localID; + + /// + /// ID of the host script engine + /// + private UUID m_itemID; + + /// + /// ID of the host/scene part + /// + private UUID m_hostID; + + /// + /// Channel + /// + private int m_channel; + + /// + /// ID to filter messages from + /// + private UUID m_id; + + /// + /// Object name to filter messages from + /// + private string m_name; + + /// + /// The message + /// + private string m_message; + + public ListenerInfo(int handle, uint localID, UUID ItemID, + UUID hostID, int channel, string name, UUID id, + string message) { Initialise(handle, localID, ItemID, hostID, channel, name, id, message, 0); @@ -806,17 +919,23 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm message, regexBitfield); } - public ListenerInfo(ListenerInfo li, string name, UUID id, string message) + public ListenerInfo(ListenerInfo li, string name, UUID id, + string message) { - Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, 0); + Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, + li.m_channel, name, id, message, 0); } - public ListenerInfo(ListenerInfo li, string name, UUID id, string message, int regexBitfield) + public ListenerInfo(ListenerInfo li, string name, UUID id, + string message, int regexBitfield) { - Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, regexBitfield); + Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, + li.m_channel, name, id, message, regexBitfield); } - private void Initialise(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message, int regexBitfield) + private void Initialise(int handle, uint localID, UUID ItemID, + UUID hostID, int channel, string name, UUID id, + string message, int regexBitfield) { m_active = true; m_handle = handle; @@ -845,9 +964,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm return data; } - public static ListenerInfo FromData(uint localID, UUID ItemID, UUID hostID, Object[] data) + public static ListenerInfo FromData(uint localID, UUID ItemID, + UUID hostID, Object[] data) { - ListenerInfo linfo = new ListenerInfo((int)data[1], localID, ItemID, hostID, (int)data[2], (string)data[3], (UUID)data[4], (string)data[5]); + ListenerInfo linfo = new ListenerInfo((int)data[1], localID, + ItemID, hostID, (int)data[2], (string)data[3], + (UUID)data[4], (string)data[5]); linfo.m_active = (bool)data[0]; if (data.Length >= 7) { diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index 0003af2cc9..385f5ad7f1 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs @@ -40,6 +40,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using Mono.Addins; /***************************************************** * @@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.XMLRPC { - public class XMLRPCModule : IRegionModule, IXMLRPC + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMLRPCModule")] + public class XMLRPCModule : ISharedRegionModule, IXMLRPC { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -86,6 +88,10 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC private Dictionary m_openChannels; private Dictionary m_pendingSRDResponses; private int m_remoteDataPort = 0; + public int Port + { + get { return m_remoteDataPort; } + } private Dictionary m_rpcPending; private Dictionary m_rpcPendingResponses; @@ -94,34 +100,24 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC private int RemoteReplyScriptWait = 300; private object XMLRPCListLock = new object(); - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { // We need to create these early because the scripts might be calling // But since this gets called for every region, we need to make sure they // get called only one time (or we lose any open channels) - if (null == m_openChannels) - { - m_openChannels = new Dictionary(); - m_rpcPending = new Dictionary(); - m_rpcPendingResponses = new Dictionary(); - m_pendingSRDResponses = new Dictionary(); + m_openChannels = new Dictionary(); + m_rpcPending = new Dictionary(); + m_rpcPendingResponses = new Dictionary(); + m_pendingSRDResponses = new Dictionary(); - try - { - m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); - } - catch (Exception) - { - } + try + { + m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); } - - if (!m_scenes.Contains(scene)) + catch (Exception) { - m_scenes.Add(scene); - - scene.RegisterModuleInterface(this); } } @@ -131,15 +127,44 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC { // Start http server // Attach xmlrpc handlers -// m_log.InfoFormat( -// "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.", -// m_remoteDataPort); + // m_log.InfoFormat( + // "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.", + // m_remoteDataPort); IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort); httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); } } + public void AddRegion(Scene scene) + { + if (!IsEnabled()) + return; + + if (!m_scenes.Contains(scene)) + { + m_scenes.Add(scene); + + scene.RegisterModuleInterface(this); + } + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + if (!IsEnabled()) + return; + + if (m_scenes.Contains(scene)) + { + scene.UnregisterModuleInterface(this); + m_scenes.Remove(scene); + } + } + public void Close() { } @@ -149,14 +174,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC get { return m_name; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } - } - - public int Port - { - get { return m_remoteDataPort; } + get { return null; } } #endregion diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs index 554168499a..7b4668aae5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -39,6 +40,7 @@ using OpenSim.Server.Handlers.Base; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AssetServiceInConnectorModule")] public class AssetServiceInConnectorModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -47,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset private IConfigSource m_Config; bool m_Registered = false; - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs index ccf22755b9..2cdffe6521 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -41,6 +42,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AuthenticationServiceInConnectorModule")] public class AuthenticationServiceInConnectorModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication private IConfigSource m_Config; bool m_Registered = false; - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs index 0e16e5ab82..22857d061e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -41,6 +42,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GridInfoServiceInConnectorModule")] public class GridInfoServiceInConnectorModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid private IConfigSource m_Config; bool m_Registered = false; - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index a7dd0dd4dd..f74929558d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -42,6 +43,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HypergridServiceInConnectorModule")] public class HypergridServiceInConnectorModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -53,7 +55,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid private GatekeeperServiceInConnector m_HypergridHandler; private UserAgentServerConnector m_UASHandler; - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs index 831ea27bd1..0a4e736fa6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -39,6 +40,7 @@ using OpenSim.Server.Handlers.Base; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InventoryServiceInConnectorModule")] public class InventoryServiceInConnectorModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -47,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory private IConfigSource m_Config; bool m_Registered = false; - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index 2f3c350c52..2fd21be8f5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -42,6 +43,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LandServiceInConnectorModule")] public class LandServiceInConnectorModule : ISharedRegionModule, ILandService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -51,7 +53,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land private IConfigSource m_Config; private List m_Scenes = new List(); - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs index ecdb380209..425febd909 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -42,6 +43,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LLLoginServiceInConnectorModule")] public class LLLoginServiceInConnectorModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -51,7 +53,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login private IConfigSource m_Config; private List m_Scenes = new List(); - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs index d38af23dd1..c14bce7474 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs @@ -42,7 +42,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceInConnectorModule")] public class MapImageServiceInConnectorModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage private IConfigSource m_Config; - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs index b544ab3be5..6bf47cbd46 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -41,6 +42,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NeighbourServiceInConnectorModule")] public class NeighbourServiceInConnectorModule : ISharedRegionModule, INeighbourService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -50,7 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour private IConfigSource m_Config; private List m_Scenes = new List(); - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs index 0a5275d3d0..57d113251c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using System.Collections.Generic; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Servers; @@ -40,7 +41,7 @@ using OpenSim.Server.Handlers.Base; namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation { - // Under construction + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimulationServiceInConnectorModule")] public class SimulationServiceInConnectorModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -49,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation private IConfigSource m_Config; bool m_Registered = false; - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index 1e1c7d00e0..d221d68f0b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using Nini.Config; using System; using System.Collections.Generic; @@ -40,8 +41,8 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { - public class HGAssetBroker : - ISharedRegionModule, IAssetService + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGAssetBroker")] + public class HGAssetBroker : ISharedRegionModule, IAssetService { private static readonly ILog m_log = LogManager.GetLogger( diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 449c1f1108..480cd695c2 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using Nini.Config; using System; using System.Collections.Generic; @@ -38,6 +39,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAssetServicesConnector")] public class LocalAssetServicesConnector : ISharedRegionModule, IAssetService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs index 8a22cfc098..e6eeacfaf6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using System; using System.Collections.Generic; using System.Reflection; @@ -38,6 +39,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAssetServicesConnector")] public class RemoteAssetServicesConnector : AssetServicesConnector, ISharedRegionModule, IAssetService { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/LocalAuthenticationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/LocalAuthenticationServiceConnector.cs index 9484a5a282..16f42a7031 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/LocalAuthenticationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/LocalAuthenticationServiceConnector.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -39,6 +40,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAuthenticationServicesConnector")] public class LocalAuthenticationServicesConnector : ISharedRegionModule, IAuthenticationService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/RemoteAuthenticationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/RemoteAuthenticationServiceConnector.cs index a053bc2cf6..7cb8b22134 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/RemoteAuthenticationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/RemoteAuthenticationServiceConnector.cs @@ -28,6 +28,7 @@ using System; using Nini.Config; using log4net; +using Mono.Addins; using System.Reflection; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -36,6 +37,7 @@ using OpenSim.Services.Connectors; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAuthenticationServicesConnector")] public class RemoteAuthenticationServicesConnector : AuthenticationServicesConnector, ISharedRegionModule, IAuthenticationService { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs index 267fb9ead9..1acb695e72 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using Nini.Config; using System; using System.Collections.Generic; @@ -39,6 +40,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAuthorizationServicesConnector")] public class LocalAuthorizationServicesConnector : INonSharedRegionModule, IAuthorizationService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs index 86c0099c68..b8d409d649 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using System; using System.Collections.Generic; using System.Reflection; @@ -39,6 +40,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAuthorizationServicesConnector")] public class RemoteAuthorizationServicesConnector : AuthorizationServicesConnector, ISharedRegionModule, IAuthorizationService { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs index 9ee19f8f25..c3ef588fbc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -40,6 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAvatarServicesConnector")] public class LocalAvatarServicesConnector : ISharedRegionModule, IAvatarService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs index d665a54a32..a087aeaedd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs @@ -26,6 +26,7 @@ */ using System; +using Mono.Addins; using Nini.Config; using log4net; using System.Reflection; @@ -36,6 +37,7 @@ using OpenSim.Services.Connectors; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAvatarServicesConnector")] public class RemoteAvatarServicesConnector : AvatarServicesConnector, ISharedRegionModule, IAvatarService { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 3c6e38127f..c0c2ca7497 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using Nini.Config; using System; using System.Collections.Generic; @@ -41,6 +42,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalGridServicesConnector")] public class LocalGridServicesConnector : ISharedRegionModule, IGridService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index e6c89d7af6..b2646babcc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using System; using System.Collections.Generic; using System.Reflection; @@ -42,6 +43,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteGridServicesConnector")] public class RemoteGridServicesConnector : ISharedRegionModule, IGridService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs index 90fe69e18c..5734334c38 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -39,6 +40,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalGridUserServicesConnector")] public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs index 04acf6732f..f7e6eb88dd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs @@ -36,10 +36,12 @@ using OpenSim.Services.Connectors; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteGridUserServicesConnector")] public class RemoteGridUserServicesConnector : ISharedRegionModule, IGridUserService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index cf6d2f7905..e474ef6bdb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using Nini.Config; using System; using System.Collections.Generic; @@ -42,6 +43,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGInventoryBroker")] public class HGInventoryBroker : ISharedRegionModule, IInventoryService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 097ff1aded..ec5751d599 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using Nini.Config; using System; @@ -41,6 +42,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalInventoryServicesConnector")] public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 11e0150083..2d3ba82e6d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -29,6 +29,7 @@ using log4net; using System; using System.Collections.Generic; using System.Reflection; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Monitoring; @@ -40,6 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteXInventoryServicesConnector")] public class RemoteXInventoryServicesConnector : ISharedRegionModule, IInventoryService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs index 86c0b85891..532993316a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using Nini.Config; using System; using System.Collections.Generic; @@ -39,8 +40,8 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land { - public class LocalLandServicesConnector : - ISharedRegionModule, ILandService + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalLandServicesConnector")] + public class LocalLandServicesConnector : ISharedRegionModule, ILandService { private static readonly ILog m_log = LogManager.GetLogger( diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs index 766ef81ea1..77dfa4a104 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using System; using System.Collections.Generic; using System.Reflection; @@ -41,6 +42,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteLandServicesConnector")] public class RemoteLandServicesConnector : LandServicesConnector, ISharedRegionModule, ILandService { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index 9d282b8741..a8390865f7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage /// /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")] public class MapImageServiceModule : ISharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs index 7a90686839..fd89428c8c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,6 +40,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalNeighbourServicesConnector")] public class LocalNeighbourServicesConnector : ISharedRegionModule, INeighbourService { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs index c6fc2a1475..e6772f3add 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs @@ -26,6 +26,7 @@ */ using log4net; +using Mono.Addins; using System; using System.Collections.Generic; using System.Reflection; @@ -39,6 +40,7 @@ using OpenSim.Server.Base; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteNeighbourServicesConnector")] public class RemoteNeighbourServicesConnector : NeighbourServicesConnector, ISharedRegionModule, INeighbourService { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs index be7c33ff9d..ba3d213e47 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs @@ -36,10 +36,12 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalPresenceServicesConnector")] public class LocalPresenceServicesConnector : ISharedRegionModule, IPresenceService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs index 2486085dea..f3e7d1f07a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs @@ -37,10 +37,12 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemotePresenceServicesConnector")] public class RemotePresenceServicesConnector : ISharedRegionModule, IPresenceService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 1e52d3705c..3c1807413b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -29,6 +29,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,6 +40,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalSimulationConnectorModule")] public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -58,7 +60,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation /// private bool m_ModuleEnabled = false; - #region IRegionModule + #region Region Module interface public void Initialise(IConfigSource config) { @@ -156,7 +158,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation } } - #endregion /* IRegionModule */ + #endregion #region ISimulation @@ -374,4 +376,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index bd4a23b873..b2a1b23279 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -32,6 +32,7 @@ using System.Net; using System.Reflection; using System.Text; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -46,6 +47,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteSimulationConnectorModule")] public class RemoteSimulationConnectorModule : ISharedRegionModule, ISimulationService { private bool initialized = false; @@ -60,7 +62,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation protected bool m_safemode; protected IPAddress m_thisIP; - #region IRegionModule + #region Region Module interface public virtual void Initialise(IConfigSource config) { @@ -147,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); } - #endregion /* IRegionModule */ + #endregion #region IInterregionComms @@ -302,4 +304,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation #endregion /* IInterregionComms */ } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 0a0ce3cf47..529bfd7289 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -39,6 +40,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalUserAccountServicesConnector")] public class LocalUserAccountServicesConnector : ISharedRegionModule, IUserAccountService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index 3321b38232..5aa87d37cc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs @@ -28,6 +28,7 @@ using System; using Nini.Config; using log4net; +using Mono.Addins; using System.Reflection; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -38,6 +39,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteUserAccountServicesConnector")] public class RemoteUserAccountServicesConnector : UserAccountServicesConnector, ISharedRegionModule, IUserAccountService { diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index e7b14547f4..1599f1537f 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,6 +40,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.World { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AccessModule")] public class AccessModule : ISharedRegionModule { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index abf3713671..1be6386971 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -32,6 +32,7 @@ using System.Reflection; using log4net; using NDesk.Options; using Nini.Config; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; @@ -42,6 +43,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// /// This module loads and saves OpenSimulator region archives /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ArchiverModule")] public class ArchiverModule : INonSharedRegionModule, IRegionArchiverModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index 5fa3dc2191..d217f36c7d 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -27,15 +27,17 @@ using System; using System.Collections.Generic; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -namespace OpenSim.Region.CoreModules +namespace OpenSim.Region.CoreModules.World { - public class CloudModule : ICloudModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CloudModule")] + public class CloudModule : ICloudModule, INonSharedRegionModule { // private static readonly log4net.ILog m_log // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -48,7 +50,7 @@ namespace OpenSim.Region.CoreModules private float m_cloudDensity = 1.0F; private float[] cloudCover = new float[16 * 16]; - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { IConfig cloudConfig = config.Configs["Cloud"]; @@ -59,21 +61,40 @@ namespace OpenSim.Region.CoreModules m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); } - if (m_enabled) - { + } - m_scene = scene; + public void AddRegion(Scene scene) + { + if (!m_enabled) + return; - scene.EventManager.OnNewClient += CloudsToClient; - scene.RegisterModuleInterface(this); - scene.EventManager.OnFrame += CloudUpdate; + m_scene = scene; - GenerateCloudCover(); + scene.EventManager.OnNewClient += CloudsToClient; + scene.RegisterModuleInterface(this); + scene.EventManager.OnFrame += CloudUpdate; - m_ready = true; + GenerateCloudCover(); - } + m_ready = true; + } + public void RemoveRegion(Scene scene) + { + if (!m_enabled) + return; + + m_ready = false; + // Remove our hooks + m_scene.EventManager.OnNewClient -= CloudsToClient; + m_scene.EventManager.OnFrame -= CloudUpdate; + m_scene.UnregisterModuleInterface(this); + + m_scene = null; + } + + public void RegionLoaded(Scene scene) + { } public void PostInitialise() @@ -82,13 +103,6 @@ namespace OpenSim.Region.CoreModules public void Close() { - if (m_enabled) - { - m_ready = false; - // Remove our hooks - m_scene.EventManager.OnNewClient -= CloudsToClient; - m_scene.EventManager.OnFrame -= CloudUpdate; - } } public string Name @@ -96,12 +110,11 @@ namespace OpenSim.Region.CoreModules get { return "CloudModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return false; } + get { return null; } } - public float CloudCover(int x, int y, int z) { float cover = 0f; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 0e6d663000..39cc93d73d 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -1072,7 +1072,7 @@ namespace OpenSim.Region.CoreModules.World.Estate #endregion - #region IRegionModule Members + #region Region Module interface public string Name { get { return "EstateManagementModule"; } } diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index d1f05a714a..bd221550cc 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs @@ -36,6 +36,7 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenMetaverse.Messages.Linden; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Capabilities; using OpenSim.Framework.Console; @@ -51,6 +52,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.World.Land { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DwellModule")] public class DwellModule : IDwellModule, INonSharedRegionModule { private Scene m_scene; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1f8e823ad9..d60654e2f7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -36,6 +36,7 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenMetaverse.Messages.Linden; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Capabilities; using OpenSim.Framework.Console; @@ -60,6 +61,7 @@ namespace OpenSim.Region.CoreModules.World.Land public byte RegionAccess; } + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LandManagementModule")] public class LandManagementModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 665875fc49..f9cc0cf1b2 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -34,6 +34,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using Mono.Addins; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; @@ -49,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Land public Dictionary Users = new Dictionary (); } + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PrimCountModule")] public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index aa306c7db5..8a422b0303 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Drawing; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -59,6 +60,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap public face[] trns; } + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageModule")] public class MapImageModule : IMapImageGenerator, INonSharedRegionModule { private static readonly ILog m_log = @@ -131,7 +133,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap #endregion - #region IRegionModule Members + #region Region Module interface public void Initialise(IConfigSource source) { diff --git a/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs similarity index 93% rename from OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs rename to OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs index 1526886d7a..c3cea7a58f 100644 --- a/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs @@ -51,10 +51,10 @@ namespace OpenSim.Region.CoreModules.World.LightShare private Scene m_scene = null; private UUID regionID = UUID.Zero; private static bool Enabled = false; - + private static readonly string capsName = "EnvironmentSettings"; private static readonly string capsBase = "/CAPS/0020/"; - + private LLSDEnvironmentSetResponse setResponse = null; #region INonSharedRegionModule @@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare } Enabled = true; - + m_log.InfoFormat("[{0}]: Module is enabled.", Name); } @@ -132,8 +132,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare #region Events private void OnRegisterCaps(UUID agentID, Caps caps) { -// m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", -// Name, agentID, caps.RegionName); + // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", + // Name, agentID, caps.RegionName); string capsPath = capsBase + UUID.Random(); @@ -163,8 +163,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare private string GetEnvironmentSettings(string request, string path, string param, UUID agentID, Caps caps) { -// m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", -// Name, agentID, caps.RegionName); + // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", + // Name, agentID, caps.RegionName); string env = String.Empty; @@ -188,8 +188,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare UUID agentID, Caps caps) { -// m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", -// Name, agentID, caps.RegionName); + // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", + // Name, agentID, caps.RegionName); setResponse.regionID = regionID; setResponse.success = false; @@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare { m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request); setResponse.success = true; - + m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}", Name, agentID, caps.RegionName); } diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs similarity index 85% rename from OpenSim/Region/CoreModules/LightShare/LightShareModule.cs rename to OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs index 16cbbf5d37..4e20196ce0 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs @@ -27,21 +27,20 @@ using System; using System.Collections.Generic; -using System.IO; using System.Reflection; using OpenMetaverse; -using log4net; -using Nini.Config; -using OpenSim.Data; using OpenSim.Framework; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; - +using log4net; +using Nini.Config; +using Mono.Addins; namespace OpenSim.Region.CoreModules.World.LightShare { - public class LightShareModule : IRegionModule, ICommandableModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LightShareModule")] + public class LightShareModule : INonSharedRegionModule, ILightShareModule, ICommandableModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly Commander m_commander = new Commander("windlight"); @@ -57,7 +56,72 @@ namespace OpenSim.Region.CoreModules.World.LightShare #endregion - #region IRegionModule Members + #region INonSharedRegionModule Members + + public void Initialise(IConfigSource config) + { + try + { + m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false); + } + catch (Exception) + { + m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); + } + + m_log.DebugFormat("[WINDLIGHT]: windlight module {0}", (m_enableWindlight ? "enabled" : "disabled")); + } + + public void AddRegion(Scene scene) + { + if (!m_enableWindlight) + return; + + m_scene = scene; + m_scene.RegisterModuleInterface(this); + m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; + + m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; + m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; + m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; + m_scene.LoadWindlightProfile(); + + InstallCommands(); + } + + public void RemoveRegion(Scene scene) + { + if (!m_enableWindlight) + return; + + m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; + + m_scene.EventManager.OnMakeRootAgent -= EventManager_OnMakeRootAgent; + m_scene.EventManager.OnSaveNewWindlightProfile -= EventManager_OnSaveNewWindlightProfile; + m_scene.EventManager.OnSendNewWindlightProfileTargeted -= EventManager_OnSendNewWindlightProfileTargeted; + + m_scene = null; + } + + public void Close() + { + } + + public string Name + { + get { return "LightShareModule"; } + } + + public void RegionLoaded(Scene scene) + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion public static bool EnableWindlight { @@ -70,34 +134,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare } } - public void Initialise(Scene scene, IConfigSource config) - { - m_scene = scene; - m_scene.RegisterModuleInterface(this); - m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; - - // ini file settings - try - { - m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false); - } - catch (Exception) - { - m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); - } - - if (m_enableWindlight) - { - m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; - m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; - m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; - m_scene.LoadWindlightProfile(); - } - - InstallCommands(); - - m_log.Debug("[WINDLIGHT]: Initialised windlight module"); - } + #region events private List compileWindlightSettings(RegionLightShareData wl) { @@ -186,29 +223,6 @@ namespace OpenSim.Region.CoreModules.World.LightShare m_scene.ForEachRootClient(SendProfileToClient); } - public void PostInitialise() - { - - } - - public void Close() - { - } - - public string Name - { - get { return "LightShareModule"; } - } - - public bool IsSharedModule - { - get { return false; } - } - - #endregion - - #region events - #endregion #region ICommandableModule Members @@ -243,7 +257,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare private void HandleDisable(Object[] args) { m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled"); - m_enableWindlight=false; + m_enableWindlight = false; } private void HandleEnable(Object[] args) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 7a8a57c833..ddaa227c79 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -37,13 +37,17 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; +using Mono.Addins; + namespace OpenSim.Region.CoreModules.World.Permissions { - public class PermissionsModule : IRegionModule, IPermissionsModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")] + public class PermissionsModule : INonSharedRegionModule, IPermissionsModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; + protected bool m_Enabled; private InventoryFolderImpl m_libraryRootFolder; protected InventoryFolderImpl LibraryRootFolder @@ -114,18 +118,44 @@ namespace OpenSim.Region.CoreModules.World.Permissions private Dictionary GrantVB = new Dictionary(); private Dictionary GrantJS = new Dictionary(); private Dictionary GrantYP = new Dictionary(); + private IFriendsModule m_friendsModule; + private IFriendsModule FriendsModule + { + get + { + if (m_friendsModule == null) + m_friendsModule = m_scene.RequestModuleInterface(); + return m_friendsModule; + } + } private IGroupsModule m_groupsModule; - private IMoapModule m_moapModule; + private IGroupsModule GroupsModule + { + get + { + if (m_groupsModule == null) + m_groupsModule = m_scene.RequestModuleInterface(); + return m_groupsModule; + } + } + private IMoapModule m_moapModule; + private IMoapModule MoapModule + { + get + { + if (m_moapModule == null) + m_moapModule = m_scene.RequestModuleInterface(); + return m_moapModule; + } + } #endregion - #region IRegionModule Members + #region INonSharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; - IConfig myConfig = config.Configs["Startup"]; string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); @@ -135,6 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (!modules.Contains("DefaultPermissionsModule")) return; + m_Enabled = true; + m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); @@ -144,7 +176,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); - m_allowedScriptCreators + m_allowedScriptCreators = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); m_allowedScriptEditors = ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors); @@ -154,97 +186,31 @@ namespace OpenSim.Region.CoreModules.World.Permissions else m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); - scene.RegisterModuleInterface(this); - - //Register functions with Scene External Checks! - m_scene.Permissions.OnBypassPermissions += BypassPermissions; - m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions; - m_scene.Permissions.OnPropagatePermissions += PropagatePermissions; - m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags; - m_scene.Permissions.OnAbandonParcel += CanAbandonParcel; - m_scene.Permissions.OnReclaimParcel += CanReclaimParcel; - m_scene.Permissions.OnDeedParcel += CanDeedParcel; - m_scene.Permissions.OnDeedObject += CanDeedObject; - m_scene.Permissions.OnIsGod += IsGod; - m_scene.Permissions.OnIsGridGod += IsGridGod; - m_scene.Permissions.OnIsAdministrator += IsAdministrator; - m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; - m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnInstantMessage += CanInstantMessage; - m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED - m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED - m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnObjectEntry += CanObjectEntry; - m_scene.Permissions.OnReturnObjects += CanReturnObjects; //NOT YET IMPLEMENTED - m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; - m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED - m_scene.Permissions.OnCompileScript += CanCompileScript; - m_scene.Permissions.OnSellParcel += CanSellParcel; - m_scene.Permissions.OnTakeObject += CanTakeObject; - m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; - m_scene.Permissions.OnTerraformLand += CanTerraformLand; - m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED - m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED - m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED - - m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED - m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED - m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED - m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED - - m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; - m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED - m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED - m_scene.Permissions.OnResetScript += CanResetScript; - - m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED - m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED - m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED - m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED - - m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED - - m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; - m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; - - m_scene.AddCommand("Users", this, "bypass permissions", - "bypass permissions ", - "Bypass permission checks", - HandleBypassPermissions); - - m_scene.AddCommand("Users", this, "force permissions", - "force permissions ", - "Force permissions on or off", - HandleForcePermissions); - - m_scene.AddCommand("Debug", this, "debug permissions", - "debug permissions ", - "Turn on permissions debugging", - HandleDebugPermissions); - - string grant = myConfig.GetString("GrantLSL",""); - if (grant.Length > 0) { - foreach (string uuidl in grant.Split(',')) { + string grant = myConfig.GetString("GrantLSL", ""); + if (grant.Length > 0) + { + foreach (string uuidl in grant.Split(',')) + { string uuid = uuidl.Trim(" \t".ToCharArray()); GrantLSL.Add(uuid, true); } } - grant = myConfig.GetString("GrantCS",""); - if (grant.Length > 0) { - foreach (string uuidl in grant.Split(',')) { + grant = myConfig.GetString("GrantCS", ""); + if (grant.Length > 0) + { + foreach (string uuidl in grant.Split(',')) + { string uuid = uuidl.Trim(" \t".ToCharArray()); GrantCS.Add(uuid, true); } } - grant = myConfig.GetString("GrantVB",""); - if (grant.Length > 0) { - foreach (string uuidl in grant.Split(',')) { + grant = myConfig.GetString("GrantVB", ""); + if (grant.Length > 0) + { + foreach (string uuidl in grant.Split(',')) + { string uuid = uuidl.Trim(" \t".ToCharArray()); GrantVB.Add(uuid, true); } @@ -269,9 +235,119 @@ namespace OpenSim.Region.CoreModules.World.Permissions GrantYP.Add(uuid, true); } } - } + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + m_scene = scene; + + scene.RegisterModuleInterface(this); + + //Register functions with Scene External Checks! + m_scene.Permissions.OnBypassPermissions += BypassPermissions; + m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions; + m_scene.Permissions.OnPropagatePermissions += PropagatePermissions; + m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags; + m_scene.Permissions.OnAbandonParcel += CanAbandonParcel; + m_scene.Permissions.OnReclaimParcel += CanReclaimParcel; + m_scene.Permissions.OnDeedParcel += CanDeedParcel; + m_scene.Permissions.OnDeedObject += CanDeedObject; + m_scene.Permissions.OnIsGod += IsGod; + m_scene.Permissions.OnIsGridGod += IsGridGod; + m_scene.Permissions.OnIsAdministrator += IsAdministrator; + m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; + m_scene.Permissions.OnDeleteObject += CanDeleteObject; + m_scene.Permissions.OnEditObject += CanEditObject; + m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; + m_scene.Permissions.OnInstantMessage += CanInstantMessage; + m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; + m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; + m_scene.Permissions.OnMoveObject += CanMoveObject; + m_scene.Permissions.OnObjectEntry += CanObjectEntry; + m_scene.Permissions.OnReturnObjects += CanReturnObjects; + m_scene.Permissions.OnRezObject += CanRezObject; + m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; + m_scene.Permissions.OnRunScript += CanRunScript; + m_scene.Permissions.OnCompileScript += CanCompileScript; + m_scene.Permissions.OnSellParcel += CanSellParcel; + m_scene.Permissions.OnTakeObject += CanTakeObject; + m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; + m_scene.Permissions.OnTerraformLand += CanTerraformLand; + m_scene.Permissions.OnLinkObject += CanLinkObject; + m_scene.Permissions.OnDelinkObject += CanDelinkObject; + m_scene.Permissions.OnBuyLand += CanBuyLand; + + m_scene.Permissions.OnViewNotecard += CanViewNotecard; + m_scene.Permissions.OnViewScript += CanViewScript; + m_scene.Permissions.OnEditNotecard += CanEditNotecard; + m_scene.Permissions.OnEditScript += CanEditScript; + + m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; + m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory; + m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; + m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; + m_scene.Permissions.OnResetScript += CanResetScript; + + m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; + m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; + m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; + m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; + + m_scene.Permissions.OnTeleport += CanTeleport; + + m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; + m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; + + m_scene.AddCommand("Users", this, "bypass permissions", + "bypass permissions ", + "Bypass permission checks", + HandleBypassPermissions); + + m_scene.AddCommand("Users", this, "force permissions", + "force permissions ", + "Force permissions on or off", + HandleForcePermissions); + + m_scene.AddCommand("Debug", this, "debug permissions", + "debug permissions ", + "Turn on permissions debugging", + HandleDebugPermissions); + + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + + m_scene.UnregisterModuleInterface(this); + } + + public void Close() + { + } + + public string Name + { + get { return "PermissionsModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion + + #region Console command handlers + public void HandleBypassPermissions(string module, string[] args) { if (m_scene.ConsoleScene() != null && @@ -290,7 +366,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_bypassPermissions = val; m_log.InfoFormat( - "[PERMISSIONS]: Set permissions bypass to {0} for {1}", + "[PERMISSIONS]: Set permissions bypass to {0} for {1}", m_bypassPermissions, m_scene.RegionInfo.RegionName); } } @@ -343,39 +419,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions } } - public void PostInitialise() - { - m_friendsModule = m_scene.RequestModuleInterface(); - - if (m_friendsModule == null) - m_log.Debug("[PERMISSIONS]: Friends module not found, friend permissions will not work"); - - m_groupsModule = m_scene.RequestModuleInterface(); - - if (m_groupsModule == null) - m_log.Debug("[PERMISSIONS]: Groups module not found, group permissions will not work"); - - m_moapModule = m_scene.RequestModuleInterface(); - - // This log line will be commented out when no longer required for debugging -// if (m_moapModule == null) -// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); - } - - public void Close() - { - } - - public string Name - { - get { return "PermissionsModule"; } - } - - public bool IsSharedModule - { - get { return false; } - } - #endregion #region Helper Functions @@ -400,10 +443,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions /// protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) { - if (null == m_groupsModule) + if (null == GroupsModule) return false; - GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID); + GroupMembershipData gmd = GroupsModule.GetMembershipData(groupID, userID); if (gmd != null) { @@ -503,10 +546,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (user == UUID.Zero) return false; - if (m_friendsModule == null) + if (FriendsModule == null) return false; - int friendPerms = m_friendsModule.GetRightsGrantedByFriend(user, objectOwner); + int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner); return (friendPerms & (int)FriendRights.CanModifyObjects) != 0; } @@ -1915,14 +1958,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions // "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", // agentID, primID, face); - if (null == m_moapModule) + if (null == MoapModule) return false; SceneObjectPart part = m_scene.GetSceneObjectPart(primID); if (null == part) return false; - MediaEntry me = m_moapModule.GetMediaEntry(part, face); + MediaEntry me = MoapModule.GetMediaEntry(part, face); // If there is no existing media entry then it can be controlled (in this context, created). if (null == me) @@ -1941,14 +1984,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions // "[PERMISSONS]: Performing CanInteractWithPrimMedia check with agentID {0}, primID {1}, face {2}", // agentID, primID, face); - if (null == m_moapModule) + if (null == MoapModule) return false; SceneObjectPart part = m_scene.GetSceneObjectPart(primID); if (null == part) return false; - MediaEntry me = m_moapModule.GetMediaEntry(part, face); + MediaEntry me = MoapModule.GetMediaEntry(part, face); // If there is no existing media entry then it can be controlled (in this context, created). if (null == me) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 0e861a1509..e0247d94b3 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -32,6 +32,7 @@ using System.Reflection; using log4net; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; @@ -41,6 +42,7 @@ using OpenSim.Region.Framework.Scenes.Serialization; namespace OpenSim.Region.CoreModules.World.Serialiser { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SerialiserModule")] public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 9a954b8d51..a321c0926e 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SunModule")] public class SunModule : ISunModule { /// @@ -267,26 +269,17 @@ namespace OpenSim.Region.CoreModules return GetCurrentSunHour() + 6.0f; } - #region IRegion Methods + #region INonSharedRegion Methods // Called immediately after the module is loaded for a given region // i.e. Immediately after instance creation. - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; m_frame = 0; // This one puts an entry in the main help screen // m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); - // This one enables the ability to type just "sun" without any parameters -// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand); - foreach (KeyValuePair kvp in GetParamList()) - { - string sunCommand = string.Format("sun {0}", kvp.Key); - m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} []", sunCommand), kvp.Value, "", HandleSunConsoleCommand); - } - TimeZone local = TimeZone.CurrentTimeZone; TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset); @@ -358,15 +351,6 @@ namespace OpenSim.Region.CoreModules HorizonShift = m_HorizonShift; // Z axis translation // HoursToRadians = (SunCycle/24)*VWTimeRatio; - // Insert our event handling hooks - - scene.EventManager.OnFrame += SunUpdate; - scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; - scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; - scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; - - ready = true; - m_log.Debug("[SUN]: Mode is " + m_RegionMode); m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); @@ -376,14 +360,37 @@ namespace OpenSim.Region.CoreModules break; } - scene.RegisterModuleInterface(this); } - public void PostInitialise() + public Type ReplaceableInterface { + get { return null; } } - public void Close() + public void AddRegion(Scene scene) + { + m_scene = scene; + // Insert our event handling hooks + + scene.EventManager.OnFrame += SunUpdate; + scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; + scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; + scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; + + scene.RegisterModuleInterface(this); + + // This one enables the ability to type just "sun" without any parameters + // m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand); + foreach (KeyValuePair kvp in GetParamList()) + { + string sunCommand = string.Format("sun {0}", kvp.Key); + m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} []", sunCommand), kvp.Value, "", HandleSunConsoleCommand); + } + + ready = true; + } + + public void RemoveRegion(Scene scene) { ready = false; @@ -394,16 +401,19 @@ namespace OpenSim.Region.CoreModules m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; } + public void RegionLoaded(Scene scene) + { + } + + public void Close() + { + } + public string Name { get { return "SunModule"; } } - public bool IsSharedModule - { - get { return false; } - } - #endregion #region EventManager Events diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 4694b148b4..52b4313306 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -33,6 +33,7 @@ using System.Net; using log4net; using Nini.Config; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; @@ -43,6 +44,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Terrain { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TerrainModule")] public class TerrainModule : INonSharedRegionModule, ICommandableModule, ITerrainModule { #region StandardTerrainEffects enum diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs index f5f35bb92e..3f5d3757bb 100644 --- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs +++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs @@ -28,15 +28,17 @@ using System; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -namespace OpenSim.Region.CoreModules.Avatar.Vegetation +namespace OpenSim.Region.CoreModules.World.Vegetation { - public class VegetationModule : IRegionModule, IVegetationModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VegetationModule")] + public class VegetationModule : INonSharedRegionModule, IVegetationModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -45,16 +47,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; public PCode[] CreationCapabilities { get { return creationCapabilities; } } - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { m_scene = scene; m_scene.RegisterModuleInterface(this); } - - public void PostInitialise() {} + + public void RemoveRegion(Scene scene) + { + m_scene.UnregisterModuleInterface(this); + } + public void Close() {} public string Name { get { return "Vegetation Module"; } } - public bool IsSharedModule { get { return false; } } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void RegionLoaded(Scene scene) + { + } public SceneObjectGroup AddTree( UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 2d762fbc8c..5e0dfa76a5 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -35,6 +35,7 @@ using CSJ2K; using Nini.Config; using log4net; using Rednettle.Warp3D; +using Mono.Addins; using OpenMetaverse; using OpenMetaverse.Imaging; using OpenMetaverse.Rendering; @@ -49,6 +50,7 @@ using WarpRenderer = global::Warp3D.Warp3D; namespace OpenSim.Region.CoreModules.World.Warp3DMap { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Warp3DImageModule")] public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule { private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3"); @@ -63,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap private bool m_useAntiAliasing = false; // TODO: Make this a config option private bool m_Enabled = false; - #region IRegionModule Members + #region Region Module interface public void Initialise(IConfigSource source) { diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs index 9d47e19439..6af40507f3 100644 --- a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs +++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs @@ -31,12 +31,14 @@ using System.Reflection; using log4net; using OpenMetaverse; +using Mono.Addins; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.World.Wind; namespace OpenSim.Region.CoreModules.World.Wind.Plugins { + [Extension(Path = "/OpenSim/WindModule", NodeName = "WindModel", Id = "ConfigurableWind")] class ConfigurableWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs index 071e20bb3b..fcb0c10e1b 100644 --- a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs +++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs @@ -29,11 +29,13 @@ using System; using System.Collections.Generic; using OpenMetaverse; +using Mono.Addins; using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.CoreModules.World.Wind.Plugins { + [Extension(Path = "/OpenSim/WindModule", NodeName = "WindModel", Id = "SimpleRandomWind")] class SimpleRandomWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin { private Vector2[] m_windSpeeds = new Vector2[16 * 16]; diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 7b6fbda952..fd8e2b4b02 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -40,6 +40,7 @@ using OpenSim.Region.CoreModules.World.Wind; namespace OpenSim.Region.CoreModules { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WindModule")] public class WindModule : IWindModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -52,31 +53,31 @@ namespace OpenSim.Region.CoreModules private bool m_ready = false; private bool m_enabled = false; - + private IConfig m_windConfig; private IWindModelPlugin m_activeWindPlugin = null; - private const string m_dWindPluginName = "SimpleRandomWind"; + private string m_dWindPluginName = "SimpleRandomWind"; private Dictionary m_availableWindPlugins = new Dictionary(); // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m private Vector2[] windSpeeds = new Vector2[16 * 16]; - #region IRegion Methods + #region INonSharedRegionModule Methods - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - IConfig windConfig = config.Configs["Wind"]; + m_windConfig = config.Configs["Wind"]; string desiredWindPlugin = m_dWindPluginName; - if (windConfig != null) + if (m_windConfig != null) { - m_enabled = windConfig.GetBoolean("enabled", true); + m_enabled = m_windConfig.GetBoolean("enabled", true); - m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150); + m_frameUpdateRate = m_windConfig.GetInt("wind_update_rate", 150); // Determine which wind model plugin is desired - if (windConfig.Contains("wind_plugin")) + if (m_windConfig.Contains("wind_plugin")) { - desiredWindPlugin = windConfig.GetString("wind_plugin"); + m_dWindPluginName = m_windConfig.GetString("wind_plugin", m_dWindPluginName); } } @@ -84,104 +85,111 @@ namespace OpenSim.Region.CoreModules { m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); - m_scene = scene; - m_frame = 0; - - // Register all the Wind Model Plug-ins - foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) - { - m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); - m_availableWindPlugins.Add(windPlugin.Name, windPlugin); - } - - // Check for desired plugin - if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) - { - m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; - - m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); - - if (windConfig != null) - { - m_activeWindPlugin.Initialise(); - m_activeWindPlugin.WindConfig(m_scene, windConfig); - } - } - - - // if the plug-in wasn't found, default to no wind. - if (m_activeWindPlugin == null) - { - m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); - m_log.ErrorFormat("[WIND] Defaulting to no wind."); - } - - // This one puts an entry in the main help screen -// m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind [value] - Get or Update Wind paramaters", null); - - // This one enables the ability to type just the base command without any parameters -// m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); - - // Get a list of the parameters for each plugin - foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) - { -// m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); - m_scene.AddCommand( - "Regions", - this, - "wind base wind_update_rate", - "wind base wind_update_rate []", - "Get or set the wind update rate.", - "", - HandleConsoleBaseCommand); - - foreach (KeyValuePair kvp in windPlugin.WindParams()) - { - string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key); - m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} []", windCommand), kvp.Value, "", HandleConsoleParamCommand); - } - } - - // Register event handlers for when Avatars enter the region, and frame ticks - m_scene.EventManager.OnFrame += WindUpdate; - m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; - - // Register the wind module - m_scene.RegisterModuleInterface(this); - - // Generate initial wind values - GenWindPos(); - - // Mark Module Ready for duty - m_ready = true; - } } - public void PostInitialise() + public void AddRegion(Scene scene) { + if (!m_enabled) + return; + + m_scene = scene; + m_frame = 0; + + // Register all the Wind Model Plug-ins + foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) + { + m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); + m_availableWindPlugins.Add(windPlugin.Name, windPlugin); + } + + // Check for desired plugin + if (m_availableWindPlugins.ContainsKey(m_dWindPluginName)) + { + m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName]; + + m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName); + + if (m_windConfig != null) + { + m_activeWindPlugin.Initialise(); + m_activeWindPlugin.WindConfig(m_scene, m_windConfig); + } + } + + + // if the plug-in wasn't found, default to no wind. + if (m_activeWindPlugin == null) + { + m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_dWindPluginName); + m_log.ErrorFormat("[WIND] Defaulting to no wind."); + } + + // This one puts an entry in the main help screen + // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind [value] - Get or Update Wind paramaters", null); + + // This one enables the ability to type just the base command without any parameters + // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); + + // Get a list of the parameters for each plugin + foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) + { + // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); + m_scene.AddCommand( + "Regions", + this, + "wind base wind_update_rate", + "wind base wind_update_rate []", + "Get or set the wind update rate.", + "", + HandleConsoleBaseCommand); + + foreach (KeyValuePair kvp in windPlugin.WindParams()) + { + string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key); + m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} []", windCommand), kvp.Value, "", HandleConsoleParamCommand); + } + } + + // Register event handlers for when Avatars enter the region, and frame ticks + m_scene.EventManager.OnFrame += WindUpdate; + m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; + + // Register the wind module + m_scene.RegisterModuleInterface(this); + + // Generate initial wind values + GenWindPos(); + + // Mark Module Ready for duty + m_ready = true; + } + + public void RemoveRegion(Scene scene) + { + if (!m_enabled) + return; + + m_ready = false; + + // REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ?? + m_activeWindPlugin = null; + foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) + { + windPlugin.Dispose(); + } + + m_availableWindPlugins.Clear(); + + // Remove our hooks + m_scene.EventManager.OnFrame -= WindUpdate; + m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; + } public void Close() { - if (m_enabled) - { - m_ready = false; - - // REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ?? - m_activeWindPlugin = null; - foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) - { - windPlugin.Dispose(); - } - - m_availableWindPlugins.Clear(); - - // Remove our hooks - m_scene.EventManager.OnFrame -= WindUpdate; - m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; - } } public string Name @@ -189,11 +197,14 @@ namespace OpenSim.Region.CoreModules get { return "WindModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return false; } + get { return null; } } + public void RegionLoaded(Scene scene) + { + } #endregion diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index f37dd943ba..46b190e701 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -24,11 +24,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -37,16 +39,22 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.World.WorldMap { - public class MapSearchModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapSearchModule")] + public class MapSearchModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); Scene m_scene = null; // only need one for communication with GridService List m_scenes = new List(); + List m_Clients; - #region IRegionModule Members - public void Initialise(Scene scene, IConfigSource source) + #region ISharedRegionModule Members + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { if (m_scene == null) { @@ -55,6 +63,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scenes.Add(scene); scene.EventManager.OnNewClient += OnNewClient; + m_Clients = new List(); + } + + public void RemoveRegion(Scene scene) + { + m_scenes.Remove(scene); + if (m_scene == scene && m_scenes.Count > 0) + m_scene = m_scenes[0]; + + scene.EventManager.OnNewClient -= OnNewClient; } public void PostInitialise() @@ -72,26 +90,63 @@ namespace OpenSim.Region.CoreModules.World.WorldMap get { return "MapSearchModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } + public void RegionLoaded(Scene scene) + { + } #endregion private void OnNewClient(IClientAPI client) { - client.OnMapNameRequest += OnMapNameRequest; + client.OnMapNameRequest += OnMapNameRequestHandler; + } + + private void OnMapNameRequestHandler(IClientAPI remoteClient, string mapName, uint flags) + { + lock (m_Clients) + { + if (m_Clients.Contains(remoteClient.AgentId)) + return; + + m_Clients.Add(remoteClient.AgentId); + } + + Util.FireAndForget(delegate + { + try + { + OnMapNameRequest(remoteClient, mapName, flags); + } + finally + { + lock (m_Clients) + m_Clients.Remove(remoteClient.AgentId); + } + }); + } private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) { - if (mapName.Length < 3) + List blocks = new List(); + MapBlockData data; + if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) { + // final block, closing the search result + AddFinalBlock(blocks); + + // flags are agent flags sent from the viewer. + // they have different values depending on different viewers, apparently + remoteClient.SendMapBlock(blocks, flags); remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); return; } + //m_log.DebugFormat("MAP NAME=({0})", mapName); // Hack to get around the fact that ll V3 now drops the port from the @@ -112,13 +167,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // try to fetch from GridServer List regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); - if (regionInfos.Count == 0) - remoteClient.SendAlertMessage("Hyperlink could not be established."); m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); - List blocks = new List(); - - MapBlockData data; if (regionInfos.Count > 0) { foreach (GridRegion info in regionInfos) @@ -145,16 +195,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } // final block, closing the search result - data = new MapBlockData(); - data.Agents = 0; - data.Access = 255; - data.MapImageId = UUID.Zero; - data.Name = ""; // mapName; - data.RegionFlags = 0; - data.WaterHeight = 0; // not used - data.X = 0; - data.Y = 0; - blocks.Add(data); + AddFinalBlock(blocks); // flags are agent flags sent from the viewer. // they have different values depending on different viewers, apparently @@ -166,12 +207,26 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (flags == 2) { if (regionInfos.Count == 0) - remoteClient.SendAgentAlertMessage("No regions found with that name.", true); + remoteClient.SendAlertMessage("No regions found with that name."); else if (regionInfos.Count == 1) - remoteClient.SendAgentAlertMessage("Region found!", false); + remoteClient.SendAlertMessage("Region found!"); } } + private void AddFinalBlock(List blocks) + { + // final block, closing the search result + MapBlockData data = new MapBlockData(); + data.Agents = 0; + data.Access = 255; + data.MapImageId = UUID.Zero; + data.Name = ""; + data.RegionFlags = 0; + data.WaterHeight = 0; // not used + data.X = 0; + data.Y = 0; + blocks.Add(data); + } // private Scene GetClientScene(IClientAPI client) // { // foreach (Scene s in m_scenes) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index dfba3ffbd2..e2f525cf47 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -40,6 +40,7 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; using OpenMetaverse.StructuredData; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Capabilities; using OpenSim.Framework.Monitoring; @@ -55,6 +56,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.World.WorldMap { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldMapModule")] public class WorldMapModule : INonSharedRegionModule, IWorldMapModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 5540656cc1..5e62f23b0c 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -35,15 +35,20 @@ using System.Xml; using log4net; using Nini.Config; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.DataSnapshot.Interfaces; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +[assembly: Addin("DataSnapshot", "0.1")] +[assembly: AddinDependency("OpenSim", "0.5")] + namespace OpenSim.Region.DataSnapshot { - public class DataSnapshotManager : IRegionModule, IDataSnapshot + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DataSnapshotManager")] + public class DataSnapshotManager : ISharedRegionModule, IDataSnapshot { #region Class members //Information from config @@ -67,6 +72,7 @@ namespace OpenSim.Region.DataSnapshot public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString(); public string m_hostname = "127.0.0.1"; private UUID m_Secret = UUID.Random(); + private bool m_servicesNotified = false; //Update timers private int m_period = 20; // in seconds @@ -93,9 +99,9 @@ namespace OpenSim.Region.DataSnapshot #endregion - #region IRegionModule + #region Region Module interface - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { if (!m_configLoaded) { @@ -133,82 +139,128 @@ namespace OpenSim.Region.DataSnapshot m_enabled = false; return; } + + if (m_enabled) + m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname); } - if (m_enabled) - { - //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer - new DataRequestHandler(scene, this); - - m_hostname = scene.RegionInfo.ExternalHostName; - m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname); - - MakeEverythingStale(); - - if (m_dataServices != "" && m_dataServices != "noservices") - NotifyDataServices(m_dataServices, "online"); - } } - if (m_enabled) + } + + public void AddRegion(Scene scene) + { + if (!m_enabled) + return; + + m_log.DebugFormat("[DATASNAPSHOT]: Module added to Scene {0}.", scene.RegionInfo.RegionName); + + m_snapStore.AddScene(scene); + m_scenes.Add(scene); + + Assembly currentasm = Assembly.GetExecutingAssembly(); + + foreach (Type pluginType in currentasm.GetTypes()) { - m_log.Info("[DATASNAPSHOT]: Scene added to module."); - - m_snapStore.AddScene(scene); - m_scenes.Add(scene); - - Assembly currentasm = Assembly.GetExecutingAssembly(); - - foreach (Type pluginType in currentasm.GetTypes()) + if (pluginType.IsPublic) { - if (pluginType.IsPublic) + if (!pluginType.IsAbstract) { - if (!pluginType.IsAbstract) + if (pluginType.GetInterface("IDataSnapshotProvider") != null) { - if (pluginType.GetInterface("IDataSnapshotProvider") != null) - { - IDataSnapshotProvider module = (IDataSnapshotProvider)Activator.CreateInstance(pluginType); - module.Initialize(scene, this); - module.OnStale += MarkDataStale; + IDataSnapshotProvider module = (IDataSnapshotProvider)Activator.CreateInstance(pluginType); + module.Initialize(scene, this); + module.OnStale += MarkDataStale; - m_dataproviders.Add(module); - m_snapStore.AddProvider(module); + m_dataproviders.Add(module); + m_snapStore.AddProvider(module); - m_log.Info("[DATASNAPSHOT]: Added new data provider type: " + pluginType.Name); - } + m_log.Debug("[DATASNAPSHOT]: Added new data provider type: " + pluginType.Name); } } } + } - //scene.OnRestart += OnSimRestart; - scene.EventManager.OnShutdown += delegate() { OnSimRestart(scene.RegionInfo); }; - } - else + // Must be done here because on shared modules, PostInitialise() will run + // BEFORE any scenes are registered. There is no "all scenes have been loaded" + // kind of callback because scenes may be created dynamically, so we cannot + // have that info, ever. + if (!m_servicesNotified) { - //m_log.Debug("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else)."); + //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer + new DataRequestHandler(m_scenes[0], this); + + m_hostname = m_scenes[0].RegionInfo.ExternalHostName; + + if (m_dataServices != "" && m_dataServices != "noservices") + NotifyDataServices(m_dataServices, "online"); + + m_servicesNotified = true; } } + public void RemoveRegion(Scene scene) + { + if (!m_enabled) + return; + + m_log.Info("[DATASNAPSHOT]: Region " + scene.RegionInfo.RegionName + " is being removed, removing from indexing"); + Scene restartedScene = SceneForUUID(scene.RegionInfo.RegionID); + + m_scenes.Remove(restartedScene); + m_snapStore.RemoveScene(restartedScene); + + //Getting around the fact that we can't remove objects from a collection we are enumerating over + List providersToRemove = new List(); + + foreach (IDataSnapshotProvider provider in m_dataproviders) + { + if (provider.GetParentScene == restartedScene) + { + providersToRemove.Add(provider); + } + } + + foreach (IDataSnapshotProvider provider in providersToRemove) + { + m_dataproviders.Remove(provider); + m_snapStore.RemoveProvider(provider); + } + + m_snapStore.RemoveScene(restartedScene); + } + + public void PostInitialise() + { + } + + public void RegionLoaded(Scene scene) + { + if (!m_enabled) + return; + + m_log.DebugFormat("[DATASNAPSHOT]: Marking scene {0} as stale.", scene.RegionInfo.RegionName); + m_snapStore.ForceSceneStale(scene); + } + public void Close() { + if (!m_enabled) + return; + if (m_enabled && m_dataServices != "" && m_dataServices != "noservices") NotifyDataServices(m_dataServices, "offline"); } - public bool IsSharedModule - { - get { return true; } - } - public string Name { get { return "External Data Generator"; } } - public void PostInitialise() + public Type ReplaceableInterface { - + get { return null; } } #endregion @@ -399,35 +451,7 @@ namespace OpenSim.Region.DataSnapshot m_snapStore.ForceSceneStale(scene); } } - #endregion - public void OnSimRestart(RegionInfo thisRegion) - { - m_log.Info("[DATASNAPSHOT]: Region " + thisRegion.RegionName + " is restarting, removing from indexing"); - Scene restartedScene = SceneForUUID(thisRegion.RegionID); - - m_scenes.Remove(restartedScene); - m_snapStore.RemoveScene(restartedScene); - - //Getting around the fact that we can't remove objects from a collection we are enumerating over - List providersToRemove = new List(); - - foreach (IDataSnapshotProvider provider in m_dataproviders) - { - if (provider.GetParentScene == restartedScene) - { - providersToRemove.Add(provider); - } - } - - foreach (IDataSnapshotProvider provider in providersToRemove) - { - m_dataproviders.Remove(provider); - m_snapStore.RemoveProvider(provider); - } - - m_snapStore.RemoveScene(restartedScene); - } } } diff --git a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs b/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs index 59cdab90db..3b3db6540d 100644 --- a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs @@ -32,6 +32,5 @@ namespace OpenSim.Region.DataSnapshot.Interfaces public interface IDataSnapshot { XmlDocument GetSnapshot(string regionName); - void MakeEverythingStale(); } } diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs index 7296ac3ef5..54172bd22f 100644 --- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs @@ -27,7 +27,7 @@ namespace OpenSim.Region.Framework.Interfaces { - public interface ICloudModule : IRegionModule + public interface ICloudModule { /// /// Retrieves the cloud density at the given region coordinates diff --git a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs index be9764a7ea..4d35c1c856 100644 --- a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs @@ -33,95 +33,140 @@ namespace OpenSim.Region.Framework.Interfaces public interface IDialogModule { /// - /// Send a non-modal alert message to a particular user. This can disappear from the user's view after a - /// small interval. + /// Send a non-modal alert message to a particular user. This can + /// disappear from the user's view after a small interval. /// - /// - /// + /// + /// IClientAPI object representing the user. + /// + /// Message text to send to the user. void SendAlertToUser(IClientAPI client, string message); - + /// /// Send an alert message to a particular user. /// - /// - /// - /// + /// + /// IClientAPI object representing the user. + /// + /// Message text to send to the user. + /// Flag to control modality. void SendAlertToUser(IClientAPI client, string message, bool modal); - + /// /// Send a non-modal alert message to a particular user. /// - /// - /// + /// UUID of agent representing the user. + /// Message text to send to the user. void SendAlertToUser(UUID agentID, string message); - + /// /// Send an alert message to a particular user. /// - /// - /// - /// + /// UUID of agent representing the user. + /// Message text to send to the user. + /// Flag to control modality. void SendAlertToUser(UUID agentID, string message, bool modal); - + /// /// Send an alert message to a particular user. /// - /// - /// - /// - /// - void SendAlertToUser(string firstName, string lastName, string message, bool modal); - + /// Account first name + /// Account last name + /// Message text to send to the user. + /// Flag to control modality. + void SendAlertToUser(string firstName, string lastName, + string message, bool modal); + /// /// Send an alert message to all users in the scene. /// - /// + /// Message text to send to all users. void SendGeneralAlert(string message); - + /// /// Send a dialog box to a particular user. /// - /// - /// - /// - /// - /// - /// - /// - /// - void SendDialogToUser( - UUID avatarID, string objectName, UUID objectID, UUID ownerID, - string message, UUID textureID, int ch, string[] buttonlabels); - + /// + /// UUID of the avatar representing the user. + /// + /// + /// Name of the object sending the dialog. + /// + /// + /// UUID of the object sending the dialog. + /// + /// + /// UUID of the user that owns the object. + /// + /// Message text to send to the user. + /// + /// Texture UUID to pass along with the dialog. + /// + /// + /// Channel on which the selected button text should be broadcast. + /// + /// Dialog button text. + void SendDialogToUser(UUID avatarID, string objectName, UUID objectID, + UUID ownerID, string message, UUID textureID, int ch, + string[] buttonlabels); + /// /// Send a url to a particular user. /// - /// - /// - /// - /// - /// - /// - /// - void SendUrlToUser( - UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url); - + /// + /// UUID of the avatar representing the user. + /// + /// + /// Name of the object sending the dialog. + /// + /// + /// UUID of the object sending the dialog. + /// + /// + /// UUID of the user that owns the object. + /// + /// + /// Flag indicating whether or not the object is group-owned. + /// + /// Message text to send to the user. + /// Url to send to the user. + void SendUrlToUser(UUID avatarID, string objectName, UUID objectID, + UUID ownerID, bool groupOwned, string message, string url); + /// - /// Send a notification to all users in the scene. This notification should remain around until the - /// user explicitly dismisses it. + /// Send a notification to all users in the scene. This notification + /// should remain around until the user explicitly dismisses it. /// - /// - /// On the Linden Labs Second Client (as of 1.21), this is a big blue box message on the upper right of the - /// screen. - /// + /// + /// On the Linden Labs Second Client (as of 1.21), this is a big blue + /// box message on the upper right of the screen. + /// /// The user sending the message - /// The name of the user doing the sending + /// + /// The name of the user doing the sending + /// /// The message being sent to the user - void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message); - + void SendNotificationToUsersInRegion(UUID fromAvatarID, + string fromAvatarName, string message); + /// /// Send a textbox entry for the client to respond to /// - void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid); + /// + /// UUID of the avatar representing the user. + /// + /// Message text to send to the user. + /// + /// Chat channel that the user's input should be broadcast on. + /// + /// Name of the object sending the dialog. + /// + /// UUID of the object sending the dialog. + /// + /// + /// UUID of the user that owns the object. + /// + void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, + string name, UUID objectid, UUID ownerid); } } diff --git a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs b/OpenSim/Region/Framework/Interfaces/ILightShareModule.cs similarity index 68% rename from OpenSim/Region/Framework/Interfaces/IRegionModule.cs rename to OpenSim/Region/Framework/Interfaces/ILightShareModule.cs index 2bb0c75b99..b5fd24fa21 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ILightShareModule.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -25,29 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using Nini.Config; -using OpenSim.Region.Framework.Scenes; - namespace OpenSim.Region.Framework.Interfaces { - /// - /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead - /// - public interface IRegionModule + public interface ILightShareModule { - /// - /// Initialize the module. - /// - /// - /// For a shared module this can be called multiple times - once per scene. - /// - /// - /// Configuration information. For a shared module this will be identical on every scene call - void Initialise(Scene scene, IConfigSource source); - - void PostInitialise(); - void Close(); - string Name { get; } - bool IsSharedModule { get; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index d582149d57..9817cf71b9 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -32,14 +32,16 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Interfaces { /// - /// Temporary interface. More methods to come at some point to make NPCs more object oriented rather than - /// controlling purely through module level interface calls (e.g. sit/stand). + /// Temporary interface. More methods to come at some point to make NPCs + /// more object oriented rather than controlling purely through module + /// level interface calls (e.g. sit/stand). /// public interface INPC { /// - /// Should this NPC be sensed by LSL sensors as an 'agent' (interpreted here to mean a normal user) - /// rather than an OpenSim specific NPC extension? + /// Should this NPC be sensed by LSL sensors as an 'agent' + /// (interpreted here to mean a normal user) rather than an OpenSim + /// specific NPC extension? /// bool SenseAsAgent { get; } } @@ -53,35 +55,42 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// Make the NPC show up as an agent on LSL sensors. The default is that they - /// show up as the NPC type instead, but this is currently an OpenSim-only extension. + /// Make the NPC show up as an agent on LSL sensors. The default is + /// that they show up as the NPC type instead, but this is currently + /// an OpenSim-only extension. /// /// - /// The avatar appearance to use for the new NPC. - /// The UUID of the ScenePresence created. UUID.Zero if there was a failure. - UUID CreateNPC( - string firstname, - string lastname, - Vector3 position, - UUID owner, - bool senseAsAgent, - Scene scene, - AvatarAppearance appearance); + /// + /// The avatar appearance to use for the new NPC. + /// + /// + /// The UUID of the ScenePresence created. UUID.Zero if there was a + /// failure. + /// + UUID CreateNPC(string firstname, string lastname, Vector3 position, + UUID owner, bool senseAsAgent, Scene scene, + AvatarAppearance appearance); /// /// Check if the agent is an NPC. /// /// /// - /// True if the agent is an NPC in the given scene. False otherwise. + /// + /// True if the agent is an NPC in the given scene. False otherwise. + /// bool IsNPC(UUID agentID, Scene scene); /// - /// Get the NPC. This is not currently complete - manipulation of NPCs still occurs through the region interface + /// Get the NPC. /// + /// + /// This is not currently complete - manipulation of NPCs still occurs + /// through the region interface. + /// /// /// - /// The NPC. null if it does not exist. + /// The NPC. null if it does not exist. INPC GetNPC(UUID agentID, Scene scene); /// @@ -89,7 +98,10 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// true if they do, false if they don't or if there's no NPC with the given ID. + /// + /// true if they do, false if they don't or if there's no NPC with the + /// given ID. + /// bool CheckPermissions(UUID npcID, UUID callerID); /// @@ -98,8 +110,12 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC - bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene); + /// + /// True if the operation succeeded, false if there was no such agent + /// or the agent was not an NPC. + /// + bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, + Scene scene); /// /// Move an NPC to a target over time. @@ -108,23 +124,29 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// If true, then the avatar will attempt to walk to the location even if it's up in the air. - /// This is to allow walking on prims. + /// If true, then the avatar will attempt to walk to the location even + /// if it's up in the air. This is to allow walking on prims. /// /// /// If true and the avatar is flying when it reaches the target, land. /// name="running"> /// If true, NPC moves with running speed. - /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC - /// - bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running); + /// + /// True if the operation succeeded, false if there was no such agent + /// or the agent was not an NPC. + /// + bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, + bool landAtTarget, bool running); /// /// Stop the NPC's current movement. /// /// The UUID of the NPC /// - /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + /// + /// True if the operation succeeded, false if there was no such agent + /// or the agent was not an NPC. + /// bool StopMoveToTarget(UUID agentID, Scene scene); /// @@ -133,7 +155,10 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// - /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + /// + /// True if the operation succeeded, false if there was no such agent + /// or the agent was not an NPC. + /// bool Say(UUID agentID, Scene scene, string text); /// @@ -143,7 +168,10 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + /// + /// True if the operation succeeded, false if there was no such agent + /// or the agent was not an NPC. + /// bool Say(UUID agentID, Scene scene, string text, int channel); /// @@ -153,7 +181,10 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + /// + /// True if the operation succeeded, false if there was no such agent + /// or the agent was not an NPC. + /// bool Shout(UUID agentID, Scene scene, string text, int channel); /// @@ -163,7 +194,10 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + /// + /// True if the operation succeeded, false if there was no such agent + /// or the agent was not an NPC. + /// bool Whisper(UUID agentID, Scene scene, string text, int channel); /// @@ -188,7 +222,9 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// true if the touch is actually attempted, false if not + /// + /// true if the touch is actually attempted, false if not. + /// bool Touch(UUID agentID, UUID partID); /// @@ -196,14 +232,20 @@ namespace OpenSim.Region.Framework.Interfaces /// /// The UUID of the NPC /// - /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + /// + /// True if the operation succeeded, false if there was no such agent + /// or the agent was not an NPC. + /// bool DeleteNPC(UUID agentID, Scene scene); /// /// Get the owner of a NPC /// /// The UUID of the NPC - /// UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC + /// + /// UUID of owner if the NPC exists, UUID.Zero if there was no such + /// agent, the agent is unowned or the agent was not an NPC. + /// UUID GetOwner(UUID agentID); } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Interfaces/ISunModule.cs b/OpenSim/Region/Framework/Interfaces/ISunModule.cs index 819ae11d3c..8231716f2e 100644 --- a/OpenSim/Region/Framework/Interfaces/ISunModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISunModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface ISunModule : IRegionModule + public interface ISunModule : INonSharedRegionModule { double GetSunParameter(string param); diff --git a/OpenSim/Region/Framework/Interfaces/IWindModule.cs b/OpenSim/Region/Framework/Interfaces/IWindModule.cs index 10ecc325c8..4a26a717db 100644 --- a/OpenSim/Region/Framework/Interfaces/IWindModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWindModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface IWindModule : IRegionModule + public interface IWindModule : INonSharedRegionModule { /// diff --git a/OpenSim/Region/Framework/ModuleLoader.cs b/OpenSim/Region/Framework/ModuleLoader.cs deleted file mode 100644 index 14ecd4430a..0000000000 --- a/OpenSim/Region/Framework/ModuleLoader.cs +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.Framework -{ - public class ModuleLoader - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public Dictionary LoadedAssemblys = new Dictionary(); - - private readonly List m_loadedModules = new List(); - private readonly Dictionary m_loadedSharedModules = new Dictionary(); - private readonly IConfigSource m_config; - - public ModuleLoader(IConfigSource config) - { - m_config = config; - } - - public IRegionModule[] GetLoadedSharedModules - { - get - { - IRegionModule[] regionModules = new IRegionModule[m_loadedSharedModules.Count]; - m_loadedSharedModules.Values.CopyTo(regionModules, 0); - return regionModules; - } - } - - public List PickupModules(Scene scene, string moduleDir) - { - DirectoryInfo dir = new DirectoryInfo(moduleDir); - List modules = new List(); - - foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) - { - modules.AddRange(LoadRegionModules(fileInfo.FullName, scene)); - } - return modules; - } - - public void LoadDefaultSharedModule(IRegionModule module) - { - if (m_loadedSharedModules.ContainsKey(module.Name)) - { - m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module not added!", module.Name); - } - else - { - m_loadedSharedModules.Add(module.Name, module); - } - } - - - public void InitialiseSharedModules(Scene scene) - { - foreach (IRegionModule module in m_loadedSharedModules.Values) - { - module.Initialise(scene, m_config); - scene.AddModule(module.Name, module); //should be doing this? - } - } - - public void InitializeModule(IRegionModule module, Scene scene) - { - module.Initialise(scene, m_config); - scene.AddModule(module.Name, module); - m_loadedModules.Add(module); - } - - /// - /// Loads/initialises a Module instance that can be used by multiple Regions - /// - /// - /// - public void LoadSharedModule(string dllName, string moduleName) - { - IRegionModule module = LoadModule(dllName, moduleName); - - if (module != null) - LoadSharedModule(module); - } - - /// - /// Loads/initialises a Module instance that can be used by multiple Regions - /// - /// - public void LoadSharedModule(IRegionModule module) - { - if (!m_loadedSharedModules.ContainsKey(module.Name)) - { - m_loadedSharedModules.Add(module.Name, module); - } - } - - public List LoadRegionModules(string dllName, Scene scene) - { - IRegionModule[] modules = LoadModules(dllName); - List initializedModules = new List(); - - if (modules.Length > 0) - { - m_log.InfoFormat("[MODULES]: Found Module Library [{0}]", dllName); - foreach (IRegionModule module in modules) - { - if (!module.IsSharedModule) - { - m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name); - InitializeModule(module, scene); - initializedModules.Add(module); - } - else - { - m_log.InfoFormat("[MODULES]: [{0}]: Loading Shared Module.", module.Name); - LoadSharedModule(module); - } - } - } - return initializedModules; - } - - public void LoadRegionModule(string dllName, string moduleName, Scene scene) - { - IRegionModule module = LoadModule(dllName, moduleName); - if (module != null) - { - InitializeModule(module, scene); - } - } - - /// - /// Loads a external Module (if not already loaded) and creates a new instance of it. - /// - /// - /// - public IRegionModule LoadModule(string dllName, string moduleName) - { - IRegionModule[] modules = LoadModules(dllName); - - foreach (IRegionModule module in modules) - { - if ((module != null) && (module.Name == moduleName)) - { - return module; - } - } - - return null; - } - - public IRegionModule[] LoadModules(string dllName) - { - //m_log.DebugFormat("[MODULES]: Looking for modules in {0}", dllName); - - List modules = new List(); - - Assembly pluginAssembly; - if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly)) - { - try - { - pluginAssembly = Assembly.LoadFrom(dllName); - LoadedAssemblys.Add(dllName, pluginAssembly); - } - catch (BadImageFormatException) - { - //m_log.InfoFormat("[MODULES]: The file [{0}] is not a module assembly.", e.FileName); - } - } - - if (pluginAssembly != null) - { - try - { - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - if (pluginType.GetInterface("IRegionModule") != null) - { - modules.Add((IRegionModule)Activator.CreateInstance(pluginType)); - } - } - } - } - } - catch (Exception e) - { - m_log.ErrorFormat( - "[MODULES]: Could not load types for plugin DLL {0}. Exception {1} {2}", - pluginAssembly.FullName, e.Message, e.StackTrace); - - // justincc: Right now this is fatal to really get the user's attention - throw e; - } - } - - return modules.ToArray(); - } - - public void PostInitialise() - { - foreach (IRegionModule module in m_loadedSharedModules.Values) - { - module.PostInitialise(); - } - - foreach (IRegionModule module in m_loadedModules) - { - module.PostInitialise(); - } - } - - public void ClearCache() - { - LoadedAssemblys.Clear(); - } - - public void UnloadModule(IRegionModule rm) - { - rm.Close(); - - m_loadedModules.Remove(rm); - } - } -} diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b23ddb4330..ad40d6ba02 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1909,8 +1909,19 @@ namespace OpenSim.Region.Framework.Scenes } } - public virtual void DeRezObjects(IClientAPI remoteClient, List localIDs, - UUID groupID, DeRezAction action, UUID destinationID) + /// + /// Derez one or more objects from the scene. + /// + /// + /// Won't actually remove the scene object in the case where the object is being copied to a user inventory. + /// + /// Client requesting derez + /// Local ids of root parts of objects to delete. + /// Not currently used. Here because the client passes this to us. + /// DeRezAction + /// User folder ID to place derezzed object + public virtual void DeRezObjects( + IClientAPI remoteClient, List localIDs, UUID groupID, DeRezAction action, UUID destinationID) { // First, see of we can perform the requested action and // build a list of eligible objects diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 69c10273c0..db45d6b4f3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -176,7 +176,6 @@ namespace OpenSim.Region.Framework.Scenes protected List m_regionRestartNotifyList = new List(); protected List m_neighbours = new List(); protected string m_simulatorVersion = "OpenSimulator Server"; - protected ModuleLoader m_moduleLoader; protected AgentCircuitManager m_authenticateHandler; protected SceneCommunicationService m_sceneGridService; @@ -659,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes public Scene(RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, - ModuleLoader moduleLoader, bool dumpAssetsToFile, + bool dumpAssetsToFile, IConfigSource config, string simulatorVersion) : this(regInfo) { @@ -670,7 +669,6 @@ namespace OpenSim.Region.Framework.Scenes Random random = new Random(); m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); - m_moduleLoader = moduleLoader; m_authenticateHandler = authen; m_sceneGridService = sceneGridService; m_SimulationDataService = simDataService; diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index b87a38a335..d3e968e531 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -67,12 +67,6 @@ namespace OpenSim.Region.Framework.Scenes /// /// All the region modules attached to this scene. /// - public Dictionary Modules - { - get { return m_modules; } - } - protected Dictionary m_modules = new Dictionary(); - public Dictionary RegionModules { get { return m_regionModules; } @@ -272,16 +266,6 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void Close() { - // Shut down all non shared modules. - foreach (IRegionModule module in Modules.Values) - { - if (!module.IsSharedModule) - { - module.Close(); - } - } - Modules.Clear(); - try { EventManager.TriggerShutdown(); @@ -311,19 +295,6 @@ namespace OpenSim.Region.Framework.Scenes #region Module Methods - /// - /// Add a module to this scene. - /// - /// - /// - public void AddModule(string name, IRegionModule module) - { - if (!Modules.ContainsKey(name)) - { - Modules.Add(name, module); - } - } - /// /// Add a region-module to this scene. TODO: This will replace AddModule in the future. /// @@ -508,9 +479,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) + public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) { - AddCommand(mod, command, shorthelp, longhelp, string.Empty, callback); + AddCommand(module, command, shorthelp, longhelp, string.Empty, callback); } /// @@ -528,9 +499,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// public void AddCommand( - string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) + string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) { - AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback); + AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback); } /// @@ -542,29 +513,14 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) + public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) { string moduleName = ""; - if (mod != null) - { - if (mod is IRegionModule) - { - IRegionModule module = (IRegionModule)mod; - moduleName = module.Name; - } - else if (mod is IRegionModuleBase) - { - IRegionModuleBase module = (IRegionModuleBase)mod; - moduleName = module.Name; - } - else - { - throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); - } - } + if (module != null) + moduleName = module.Name; - AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback); + AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback); } /// @@ -580,7 +536,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// public void AddCommand( - string category, object mod, string command, + string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) { if (MainConsole.Instance == null) @@ -588,22 +544,8 @@ namespace OpenSim.Region.Framework.Scenes bool shared = false; - if (mod != null) - { - if (mod is IRegionModule) - { - IRegionModule module = (IRegionModule)mod; - shared = module.IsSharedModule; - } - else if (mod is IRegionModuleBase) - { - shared = mod is ISharedRegionModule; - } - else - { - throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); - } - } + if (module != null) + shared = module is ISharedRegionModule; MainConsole.Instance.Commands.AddCommand( category, shared, command, shorthelp, longhelp, descriptivehelp, callback); diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index cb5b2ba9b2..9bd27d342f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -141,31 +141,6 @@ namespace OpenSim.Region.Framework.Scenes public void Close() { - // collect known shared modules in sharedModules - Dictionary sharedModules = new Dictionary(); - - lock (m_localScenes) - { - for (int i = 0; i < m_localScenes.Count; i++) - { - // extract known shared modules from scene - foreach (string k in m_localScenes[i].Modules.Keys) - { - if (m_localScenes[i].Modules[k].IsSharedModule && - !sharedModules.ContainsKey(k)) - sharedModules[k] = m_localScenes[i].Modules[k]; - } - // close scene/region - m_localScenes[i].Close(); - } - } - - // all regions/scenes are now closed, we can now safely - // close all shared modules - foreach (IRegionModule mod in sharedModules.Values) - { - mod.Close(); - } } public void Close(Scene cscene) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 3398a53fb8..5b334c6564 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections.Generic; using System.Reflection; using System.Threading; using NUnit.Framework; @@ -33,6 +34,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; @@ -42,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests /// Basic scene object tests (create, read and delete but not update). /// [TestFixture] - public class SceneObjectBasicTests + public class SceneObjectBasicTests : OpenSimTestCase { // [TearDown] // public void TearDown() @@ -237,38 +239,60 @@ namespace OpenSim.Region.Framework.Scenes.Tests /// /// Test deleting an object asynchronously to user inventory. /// - //[Test] - //public void TestDeleteSceneObjectAsyncToUserInventory() - //{ - // TestHelper.InMethod(); - // //log4net.Config.XmlConfigurator.Configure(); - - // UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); - // string myObjectName = "Fred"; - - // TestScene scene = SceneSetupHelpers.SetupScene(); - // SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName); - - // Assert.That( - // scene.CommsManager.UserAdminService.AddUser( - // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), - // Is.EqualTo(agentId)); - - // IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); - - // CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); - // Assert.That(userInfo, Is.Not.Null); - // Assert.That(userInfo.RootFolder, Is.Not.Null); - - // SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); - - // // Check that we now have the taken part in our inventory - // Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); - - // // Check that the taken part has actually disappeared - // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); - // Assert.That(retrievedPart, Is.Null); - //} +// [Test] + public void TestDeleteSceneObjectAsyncToUserInventory() + { + TestHelpers.InMethod(); + TestHelpers.EnableLogging(); + + UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); + string myObjectName = "Fred"; + + TestScene scene = new SceneHelpers().SetupScene(); + + // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. + AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; + sogd.Enabled = false; + + SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId); + +// Assert.That( +// scene.CommsManager.UserAdminService.AddUser( +// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), +// Is.EqualTo(agentId)); + + UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId); + InventoryFolderBase folder1 + = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1"); + + IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; + scene.DeRezObjects(client, new List() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID); + + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); + + Assert.That(retrievedPart, Is.Not.Null); + Assert.That(so.IsDeleted, Is.False); + + sogd.InventoryDeQueueAndDelete(); + + Assert.That(so.IsDeleted, Is.True); + + SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); + Assert.That(retrievedPart2, Is.Null); + +// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); + + InventoryItemBase retrievedItem + = UserInventoryHelpers.GetInventoryItem( + scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName); + + // Check that we now have the taken part in our inventory + Assert.That(retrievedItem, Is.Not.Null); + + // Check that the taken part has actually disappeared +// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); +// Assert.That(retrievedPart, Is.Null); + } /// /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs index cfe1278786..406b715f25 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Net; using System.Reflection; using log4net; @@ -33,29 +34,65 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server; +using Mono.Addins; + namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView { - public class IRCStackModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "IRCStackModule")] + public class IRCStackModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IRCServer m_server; + private int m_Port; // private Scene m_scene; + private bool m_Enabled; - #region Implementation of IRegionModule + #region Implementation of INonSharedRegionModule - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { if (null != source.Configs["IRCd"] && - source.Configs["IRCd"].GetBoolean("Enabled",false)) + source.Configs["IRCd"].GetBoolean("Enabled", false)) { - int portNo = source.Configs["IRCd"].GetInt("Port",6666); -// m_scene = scene; - m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene); - m_server.OnNewIRCClient += m_server_OnNewIRCClient; + m_Enabled = true; + m_Port = source.Configs["IRCd"].GetInt("Port", 6666); } } + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), m_Port, scene); + m_server.OnNewIRCClient += m_server_OnNewIRCClient; + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + } + + public void Close() + { + } + + public string Name + { + get { return "IRCClientStackModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion + void m_server_OnNewIRCClient(IRCClientView user) { user.OnIRCReady += user_OnIRCReady; @@ -68,26 +105,5 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView m_log.Info("[IRCd] Added user to Scene"); } - public void PostInitialise() - { - - } - - public void Close() - { - - } - - public string Name - { - get { return "IRCClientStackModule"; } - } - - public bool IsSharedModule - { - get { return false; } - } - - #endregion } } diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 5fe594860d..992f38ecb9 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -40,7 +40,7 @@ using OpenSim.Region.ClientStack.LindenUDP; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -namespace OpenSim.Region.CoreModules.UDP.Linden +namespace OpenSim.Region.OptionalModules.UDP.Linden { /// /// A module that just holds commands for inspecting the current state of the Linden UDP stack. diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs index 913d934cf3..2e1d03d530 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using System.Net; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; @@ -40,6 +41,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Avatar.Chat { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "IRCBridgeModule")] public class IRCBridgeModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index 5c3be29e9a..018357adf1 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs @@ -36,6 +36,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading; using log4net; +using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -47,6 +48,7 @@ using OpenSim.Region.CoreModules.Avatar.Chat; namespace OpenSim.Region.OptionalModules.Avatar.Concierge { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ConciergeModule")] public class ConciergeModule : ChatModule, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index c5fcef4646..881807abd7 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -36,6 +36,7 @@ using System.Reflection; using System.Threading; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; @@ -49,6 +50,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VivoxVoiceModule")] public class VivoxVoiceModule : ISharedRegionModule { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 1528330385..2802e2fb7f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -42,7 +42,7 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsMessagingModule")] public class GroupsMessagingModule : ISharedRegionModule, IGroupsMessagingModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -79,7 +79,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private int m_usersOnlineCacheExpirySeconds = 20; - #region IRegionModuleBase Members + #region Region Module interfaceBase Members public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index b9b441331a..193d1db84d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -43,7 +43,7 @@ using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsModule")] public class GroupsModule : ISharedRegionModule, IGroupsModule { /// @@ -86,7 +86,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private bool m_debugEnabled = false; private int m_levelGroupCreate = 0; - #region IRegionModuleBase Members + #region Region Module interfaceBase Members public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 5d57f70733..7bae8f74f7 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -102,7 +102,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianGroupsServicesConnectorModule")] public class SimianGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -176,7 +176,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // private IUserAccountService m_accountService = null; - #region IRegionModuleBase Members + #region Region Module interfaceBase Members public string Name { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index d412cd1082..d0c3ea5910 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -47,7 +47,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcGroupsServicesConnectorModule")] public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -83,7 +83,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private Dictionary> m_groupsAgentsDroppedFromChatSession = new Dictionary>(); private Dictionary> m_groupsAgentsInvitedToChatSession = new Dictionary>(); - #region IRegionModuleBase Members + #region Region Module interfaceBase Members public string Name { diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs index dddea3e1d8..781fe952d2 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs @@ -33,9 +33,6 @@ using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -[assembly: Addin("BareBonesSharedModule", "0.1")] -[assembly: AddinDependency("OpenSim", "0.5")] - namespace OpenSim.Region.OptionalModules.Example.BareBonesShared { /// diff --git a/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml b/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml deleted file mode 100644 index 869134354f..0000000000 --- a/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index 732c28f66d..e68764ab63 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore private Dictionary m_JsonValueStore; private UUID m_sharedStore; -#region IRegionModule Members +#region Region Module interface // ----------------------------------------------------------------- /// diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index 6910d14c67..0c175caa7f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore private IScriptModuleComms m_comms; private IJsonStoreModule m_store; -#region IRegionModule Members +#region Region Module interface // ----------------------------------------------------------------- /// diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 03481d2d29..6fb28e2d1b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -43,13 +43,17 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using Mono.Addins; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - public class MRMModule : IRegionModule, IMRMModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MRMModule")] + public class MRMModule : INonSharedRegionModule, IMRMModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; + private bool m_Enabled; + private bool m_Hidden; private readonly Dictionary m_scripts = new Dictionary(); @@ -67,7 +71,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule m_extensions[typeof (T)] = instance; } - public void Initialise(Scene scene, IConfigSource source) + #region INonSharedRegionModule + + public void Initialise(IConfigSource source) { if (source.Configs["MRM"] != null) { @@ -76,23 +82,60 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (source.Configs["MRM"].GetBoolean("Enabled", false)) { m_log.Info("[MRM]: Enabling MRM Module"); - m_scene = scene; - - // when hidden, we don't listen for client initiated script events - // only making the MRM engine available for region modules - if (!source.Configs["MRM"].GetBoolean("Hidden", false)) - { - scene.EventManager.OnRezScript += EventManager_OnRezScript; - scene.EventManager.OnStopScript += EventManager_OnStopScript; - } - - scene.EventManager.OnFrame += EventManager_OnFrame; - - scene.RegisterModuleInterface(this); + m_Enabled = true; + m_Hidden = source.Configs["MRM"].GetBoolean("Hidden", false); } } } + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + m_scene = scene; + + // when hidden, we don't listen for client initiated script events + // only making the MRM engine available for region modules + if (!m_Hidden) + { + scene.EventManager.OnRezScript += EventManager_OnRezScript; + scene.EventManager.OnStopScript += EventManager_OnStopScript; + } + + scene.EventManager.OnFrame += EventManager_OnFrame; + + scene.RegisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + } + + public void Close() + { + foreach (KeyValuePair pair in m_scripts) + { + pair.Value.Stop(); + } + } + + public string Name + { + get { return "MiniRegionModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion + void EventManager_OnStopScript(uint localID, UUID itemID) { if (m_scripts.ContainsKey(itemID)) @@ -293,28 +336,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule mmb.InitMiniModule(world, host, itemID); } - public void PostInitialise() - { - } - - public void Close() - { - foreach (KeyValuePair pair in m_scripts) - { - pair.Value.Stop(); - } - } - - public string Name - { - get { return "MiniRegionModule"; } - } - - public bool IsSharedModule - { - get { return false; } - } - /// /// Stolen from ScriptEngine Common /// diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index bad75f7819..c550c44243 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -32,6 +32,7 @@ using System.Net; using System.IO; using System.Text; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -42,6 +43,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.Scripting.RegionReady { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionReadyModule")] public class RegionReadyModule : IRegionReadyModule, INonSharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index 2187449471..6120a81b6c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs @@ -32,6 +32,7 @@ using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Communications; @@ -49,7 +50,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule public string uri; } - public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcGridRouter")] + public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -59,9 +61,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule private bool m_Enabled = false; private string m_ServerURI = String.Empty; - public void Initialise(Scene scene, IConfigSource config) + #region INonSharedRegionModule + + public void Initialise(IConfigSource config) { - IConfig startupConfig = config.Configs["Startup"]; + IConfig startupConfig = config.Configs["XMLRPC"]; if (startupConfig == null) return; @@ -74,14 +78,28 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling"); return; } - - scene.RegisterModuleInterface(this); m_Enabled = true; } } - public void PostInitialise() + public void AddRegion(Scene scene) { + if (!m_Enabled) + return; + + scene.RegisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + + scene.UnregisterModuleInterface(this); } public void Close() @@ -93,11 +111,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule get { return "XmlRpcGridRouterModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return false; } + get { return null; } } + #endregion + public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) { if (!m_Channels.ContainsKey(itemID)) diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs index 32659c8e5d..4783f4c25a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs @@ -31,6 +31,7 @@ using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -39,25 +40,44 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule { - public class XmlRpcRouter : IRegionModule, IXmlRpcRouter + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcRouter")] + public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public void Initialise(Scene scene, IConfigSource config) + + private bool m_Enabled; + + #region INonSharedRegionModule + + public void Initialise(IConfigSource config) { - IConfig startupConfig = config.Configs["Startup"]; + IConfig startupConfig = config.Configs["XMLRPC"]; if (startupConfig == null) return; if (startupConfig.GetString("XmlRpcRouterModule", "XmlRpcRouterModule") == "XmlRpcRouterModule") - { - scene.RegisterModuleInterface(this); - } + m_Enabled = true; } - public void PostInitialise() + public void AddRegion(Scene scene) { + if (!m_Enabled) + return; + + scene.RegisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + + scene.UnregisterModuleInterface(this); } public void Close() @@ -69,11 +89,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule get { return "XmlRpcRouterModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return false; } + get { return null; } } + #endregion + public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) { scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri}); diff --git a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs index 74c51391c1..78c870adf4 100644 --- a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs @@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Freeswitch private IConfigSource m_Config; bool m_Registered = false; - #region IRegionModule interface + #region Region Module interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs index ec9f1578e7..1d35c54efc 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs @@ -33,6 +33,7 @@ using System.Reflection; using System.Timers; using System.Text.RegularExpressions; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -95,6 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup /// Save memory by setting low initial capacities. Minimizes impact in common cases of all regions using same interval, and instances hosting 1 ~ 4 regions. /// Also helps if you don't want AutoBackup at all. /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AutoBackupModule")] public class AutoBackupModule : ISharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 9c838d057c..8f04ede454 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule /// /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SampleMoneyModule")] public class SampleMoneyModule : IMoneyModule, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3f25bcf58e..7d46d92613 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -29,37 +29,57 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Threading; +using Timer = System.Timers.Timer; + using log4net; using Nini.Config; +using Mono.Addins; using OpenMetaverse; + using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Framework; -using Timer=System.Timers.Timer; using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.World.NPC { - public class NPCModule : IRegionModule, INPCModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NPCModule")] + public class NPCModule : INPCModule, ISharedRegionModule { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); - private Dictionary m_avatars = new Dictionary(); + private Dictionary m_avatars = + new Dictionary(); - public void Initialise(Scene scene, IConfigSource source) + public bool Enabled { get; private set; } + + public void Initialise(IConfigSource source) { IConfig config = source.Configs["NPC"]; - if (config != null && config.GetBoolean("Enabled", false)) - { + Enabled = (config != null && config.GetBoolean("Enabled", false)); + } + + public void AddRegion(Scene scene) + { + if (Enabled) scene.RegisterModuleInterface(this); - } + } + + public void RegionLoaded(Scene scene) + { } public void PostInitialise() { } + public void RemoveRegion(Scene scene) + { + scene.UnregisterModuleInterface(this); + } + public void Close() { } @@ -69,15 +89,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC get { return "NPCModule"; } } - public bool IsSharedModule - { - get { return true; } - } + public Type ReplaceableInterface { get { return null; } } public bool IsNPC(UUID agentId, Scene scene) { - // FIXME: This implementation could not just use the ScenePresence.PresenceType (and callers could inspect - // that directly). + // FIXME: This implementation could not just use the + // ScenePresence.PresenceType (and callers could inspect that + // directly). ScenePresence sp = scene.GetScenePresence(agentId); if (sp == null || sp.IsChildAgent) return false; @@ -86,7 +104,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC return m_avatars.ContainsKey(agentId); } - public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) + public bool SetNPCAppearance(UUID agentId, + AvatarAppearance appearance, Scene scene) { ScenePresence npc = scene.GetScenePresence(agentId); if (npc == null || npc.IsChildAgent) @@ -99,34 +118,35 @@ namespace OpenSim.Region.OptionalModules.World.NPC // Delete existing npc attachments scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); - // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments - AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); + // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet + // since it doesn't transfer attachments + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, + true); npc.Appearance = npcAppearance; - + // Rez needed npc attachments scene.AttachmentsModule.RezAttachments(npc); - IAvatarFactoryModule module = scene.RequestModuleInterface(); + IAvatarFactoryModule module = + scene.RequestModuleInterface(); module.SendAppearance(npc.UUID); - + return true; } - public UUID CreateNPC( - string firstname, - string lastname, - Vector3 position, - UUID owner, - bool senseAsAgent, - Scene scene, - AvatarAppearance appearance) + public UUID CreateNPC(string firstname, string lastname, + Vector3 position, UUID owner, bool senseAsAgent, Scene scene, + AvatarAppearance appearance) { - NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, owner, senseAsAgent, scene); - npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); + NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, + owner, senseAsAgent, scene); + npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, + int.MaxValue); m_log.DebugFormat( - "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", - firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName); + "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", + firstname, lastname, npcAvatar.AgentId, owner, + senseAsAgent, position, scene.RegionInfo.RegionName); AgentCircuitData acd = new AgentCircuitData(); acd.AgentID = npcAvatar.AgentId; @@ -134,42 +154,55 @@ namespace OpenSim.Region.OptionalModules.World.NPC acd.lastname = lastname; acd.ServiceURLs = new Dictionary(); - AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, + true); acd.Appearance = npcAppearance; -// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++) -// { -// m_log.DebugFormat( -// "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}", -// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); -// } + /* + for (int i = 0; + i < acd.Appearance.Texture.FaceTextures.Length; i++) + { + m_log.DebugFormat( + "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}", + acd.AgentID, i, + acd.Appearance.Texture.FaceTextures[i]); + } + */ lock (m_avatars) { - scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); + scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, + acd); scene.AddNewClient(npcAvatar, PresenceType.Npc); ScenePresence sp; if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) { -// m_log.DebugFormat( -// "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); + /* + m_log.DebugFormat( + "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", + sp.Name, sp.UUID); + */ sp.CompleteMovement(npcAvatar, false); m_avatars.Add(npcAvatar.AgentId, npcAvatar); - m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); + m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", + npcAvatar.AgentId, sp.Name); return npcAvatar.AgentId; } else { - m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); + m_log.WarnFormat( + "[NPC MODULE]: Could not find scene presence for NPC {0} {1}", + sp.Name, sp.UUID); return UUID.Zero; } } } - public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, + bool noFly, bool landAtTarget, bool running) { lock (m_avatars) { @@ -179,12 +212,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC if (scene.TryGetScenePresence(agentID, out sp)) { m_log.DebugFormat( - "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", - sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); + "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", + sp.Name, pos, scene.RegionInfo.RegionName, + noFly, landAtTarget); sp.MoveToTarget(pos, noFly, landAtTarget); sp.SetAlwaysRun = running; - + return true; } } @@ -257,9 +291,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC ScenePresence sp; if (scene.TryGetScenePresence(agentID, out sp)) { - sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); - // sp.HandleAgentSit(m_avatars[agentID], agentID); - + sp.HandleAgentRequestSit(m_avatars[agentID], agentID, + partID, Vector3.Zero); + //sp.HandleAgentSit(m_avatars[agentID], agentID); + return true; } } @@ -268,7 +303,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC return false; } - public bool Whisper(UUID agentID, Scene scene, string text, int channel) + public bool Whisper(UUID agentID, Scene scene, string text, + int channel) { lock (m_avatars) { @@ -343,16 +379,23 @@ namespace OpenSim.Region.OptionalModules.World.NPC NPCAvatar av; if (m_avatars.TryGetValue(agentID, out av)) { -// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name); + /* + m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", + agentID, av.Name); + */ scene.RemoveClient(agentID, false); m_avatars.Remove(agentID); - - m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); + /* + m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", + agentID, av.Name); + */ return true; } } - -// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID); + /* + m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", + agentID); + */ return false; } @@ -376,7 +419,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC /// true if they do, false if they don't. private bool CheckPermissions(NPCAvatar av, UUID callerID) { - return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID; + return callerID == UUID.Zero || av.OwnerID == UUID.Zero || + av.OwnerID == callerID; } } } diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 51b0592356..81448709cf 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -31,6 +31,7 @@ using System.Reflection; using System.Timers; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; @@ -46,7 +47,8 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator /// /// Version 2.02 - Still hacky /// - public class TreePopulatorModule : IRegionModule, ICommandableModule, IVegetationModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TreePopulatorModule")] + public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule, IVegetationModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly Commander m_commander = new Commander("tree"); @@ -168,15 +170,11 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator #endregion - #region IRegionModule Members + #region Region Module interface - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; - m_scene.RegisterModuleInterface(this); - m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; - // ini file settings try { @@ -201,7 +199,19 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator m_log.Debug("[TREES]: Initialised tree module"); } - public void PostInitialise() + public void AddRegion(Scene scene) + { + m_scene = scene; + m_scene.RegisterModuleCommander(m_commander); + m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; + + } + + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) { ReloadCopse(); if (m_copse.Count > 0) @@ -220,11 +230,12 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator get { return "TreePopulatorModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return false; } + get { return null; } } + #endregion //-------------------------------------------------------------- @@ -448,8 +459,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator m_commander.RegisterCommand("reload", treeReloadCommand); m_commander.RegisterCommand("remove", treeRemoveCommand); m_commander.RegisterCommand("statistics", treeStatisticsCommand); - - m_scene.RegisterModuleCommander(m_commander); } /// diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs index 1aee39a5b9..baf55c34af 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs @@ -32,6 +32,7 @@ using System.Drawing.Imaging; using System.Reflection; using System.IO; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -45,6 +46,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.World.WorldView { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldViewModule")] public class WorldViewModule : INonSharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index be030af5db..acf4d8c1d2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6637,6 +6637,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SetCameraAtOffset(offset); } + public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) + { + m_host.AddScriptLPS(1); + + if (link == ScriptBaseClass.LINK_SET || + link == ScriptBaseClass.LINK_ALL_CHILDREN || + link == ScriptBaseClass.LINK_ALL_OTHERS) return; + + SceneObjectPart part = null; + + switch (link) + { + case ScriptBaseClass.LINK_ROOT: + part = m_host.ParentGroup.RootPart; + break; + case ScriptBaseClass.LINK_THIS: + part = m_host; + break; + default: + part = m_host.ParentGroup.GetLinkNumPart(link); + break; + } + + if (null != part) + { + part.SetCameraEyeOffset(eye); + part.SetCameraAtOffset(at); + } + } + public LSL_String llDumpList2String(LSL_List src, string seperator) { m_host.AddScriptLPS(1); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index e97ff9d1ba..98f8be7175 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -333,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetBuoyancy(double buoyancy); void llSetCameraAtOffset(LSL_Vector offset); void llSetCameraEyeOffset(LSL_Vector offset); + void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at); void llSetCameraParams(LSL_List rules); void llSetClickAction(int action); void llSetColor(LSL_Vector color, int face); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index c4578804c2..36803a4ae2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1498,6 +1498,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSetCameraEyeOffset(offset); } + public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) + { + m_LSL_Functions.llSetLinkCamera(link, eye, at); + } + public void llSetCameraParams(LSL_List rules) { m_LSL_Functions.llSetCameraParams(rules); diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index 625eba4b0a..b08233c7aa 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -43,15 +43,20 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Mono.Data.SqliteClient; +using Mono.Addins; using Caps = OpenSim.Framework.Capabilities.Caps; using OSD = OpenMetaverse.StructuredData.OSD; using OSDMap = OpenMetaverse.StructuredData.OSDMap; +[assembly: Addin("WebStats", "1.0")] +[assembly: AddinDependency("OpenSim", "0.5")] + namespace OpenSim.Region.UserStatistics { - public class WebStatsModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")] + public class WebStatsModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -74,59 +79,69 @@ namespace OpenSim.Region.UserStatistics private string m_loglines = String.Empty; private volatile int lastHit = 12000; - public virtual void Initialise(Scene scene, IConfigSource config) + #region ISharedRegionModule + + public virtual void Initialise(IConfigSource config) { IConfig cnfg = config.Configs["WebStats"]; if (cnfg != null) enabled = cnfg.GetBoolean("enabled", false); - + } + + public virtual void PostInitialise() + { + if (!enabled) + return; + + AddEventHandlers(); + + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + + //IConfig startupConfig = config.Configs["Startup"]; + + dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); + dbConn.Open(); + CreateTables(dbConn); + + Prototype_distributor protodep = new Prototype_distributor(); + Updater_distributor updatedep = new Updater_distributor(); + ActiveConnectionsAJAX ajConnections = new ActiveConnectionsAJAX(); + SimStatsAJAX ajSimStats = new SimStatsAJAX(); + LogLinesAJAX ajLogLines = new LogLinesAJAX(); + Default_Report defaultReport = new Default_Report(); + Clients_report clientReport = new Clients_report(); + Sessions_Report sessionsReport = new Sessions_Report(); + + reports.Add("prototype.js", protodep); + reports.Add("updater.js", updatedep); + reports.Add("activeconnectionsajax.html", ajConnections); + reports.Add("simstatsajax.html", ajSimStats); + reports.Add("activelogajax.html", ajLogLines); + reports.Add("default.report", defaultReport); + reports.Add("clients.report", clientReport); + reports.Add("sessions.report", sessionsReport); + + //// + // Add Your own Reports here (Do Not Modify Lines here Devs!) + //// + + //// + // End Own reports section + //// + + MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); + MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); + } + + public virtual void AddRegion(Scene scene) + { if (!enabled) return; lock (m_scenes) { - if (m_scenes.Count == 0) - { - if (Util.IsWindows()) - Util.LoadArchSpecificWindowsDll("sqlite3.dll"); - - //IConfig startupConfig = config.Configs["Startup"]; - - dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); - dbConn.Open(); - CreateTables(dbConn); - - Prototype_distributor protodep = new Prototype_distributor(); - Updater_distributor updatedep = new Updater_distributor(); - ActiveConnectionsAJAX ajConnections = new ActiveConnectionsAJAX(); - SimStatsAJAX ajSimStats = new SimStatsAJAX(); - LogLinesAJAX ajLogLines = new LogLinesAJAX(); - Default_Report defaultReport = new Default_Report(); - Clients_report clientReport = new Clients_report(); - Sessions_Report sessionsReport = new Sessions_Report(); - - reports.Add("prototype.js", protodep); - reports.Add("updater.js", updatedep); - reports.Add("activeconnectionsajax.html", ajConnections); - reports.Add("simstatsajax.html", ajSimStats); - reports.Add("activelogajax.html", ajLogLines); - reports.Add("default.report", defaultReport); - reports.Add("clients.report", clientReport); - reports.Add("sessions.report", sessionsReport); - - //// - // Add Your own Reports here (Do Not Modify Lines here Devs!) - //// - - //// - // End Own reports section - //// - - MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); - MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); - } - m_scenes.Add(scene); if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID)) m_simstatsCounters.Remove(scene.RegionInfo.RegionID); @@ -136,6 +151,39 @@ namespace OpenSim.Region.UserStatistics } } + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + } + + public virtual void Close() + { + if (!enabled) + return; + + dbConn.Close(); + dbConn.Dispose(); + m_sessions.Clear(); + m_scenes.Clear(); + reports.Clear(); + m_simstatsCounters.Clear(); + } + + public virtual string Name + { + get { return "ViewerStatsModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion + private void ReceiveClassicSimStatsPacket(SimStats stats) { if (!enabled) @@ -251,37 +299,6 @@ namespace OpenSim.Region.UserStatistics } } - public virtual void PostInitialise() - { - if (!enabled) - return; - - AddHandlers(); - } - - public virtual void Close() - { - if (!enabled) - return; - - dbConn.Close(); - dbConn.Dispose(); - m_sessions.Clear(); - m_scenes.Clear(); - reports.Clear(); - m_simstatsCounters.Clear(); - } - - public virtual string Name - { - get { return "ViewerStatsModule"; } - } - - public bool IsSharedModule - { - get { return true; } - } - private void OnRegisterCaps(UUID agentID, Caps caps) { // m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); @@ -302,7 +319,7 @@ namespace OpenSim.Region.UserStatistics { } - protected virtual void AddHandlers() + protected virtual void AddEventHandlers() { lock (m_scenes) { diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 6bfc5cc4f2..63a32e749a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -45,7 +45,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// Connects to the SimianGrid asset service /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianAssetServiceConnector")] public class SimianAssetServiceConnector : IAssetService, ISharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 69f6ed2eac..6603f6e4dc 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -43,7 +43,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// Connects authentication/authorization to the SimianGrid backend /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianAuthenticationServiceConnector")] public class SimianAuthenticationServiceConnector : IAuthenticationService, ISharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 360f0dd29f..841bfa0bd1 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -47,7 +47,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// Connects avatar appearance data to the SimianGrid backend /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianAvatarServiceConnector")] public class SimianAvatarServiceConnector : IAvatarService, ISharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index f828abbb58..4d7841b415 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -59,7 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// Connects avatar inventories to the SimianGrid backend /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianInventoryServiceConnector")] public class SimianInventoryServiceConnector : IInventoryService, ISharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index e10b29c3f4..9e7122184d 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -47,7 +47,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// Connects avatar presence information (for tracking current location and /// message routing) to the SimianGrid backend /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianPresenceServiceConnector")] public class SimianPresenceServiceConnector : IPresenceService, IGridUserService, ISharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 6aefc38ed3..bd8069f49c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -59,7 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// Connects avatar profile and classified queries to the SimianGrid /// backend /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianProfiles")] public class SimianProfiles : INonSharedRegionModule { private static readonly ILog m_log = diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 4350749295..6e32b3a7be 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -45,7 +45,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// Connects user account data (creating new users, looking up existing /// users) to the SimianGrid backend /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianUserAccountServiceConnector")] public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule { private const double CACHE_EXPIRATION_SECONDS = 120.0; diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index fc49169c97..ea3e3487f0 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -139,11 +139,11 @@ namespace OpenSim.Tests.Common SceneCommunicationService scs = new SceneCommunicationService(); TestScene testScene = new TestScene( - regInfo, m_acm, scs, m_simDataService, m_estateDataService, null, false, configSource, null); + regInfo, m_acm, scs, m_simDataService, m_estateDataService, false, configSource, null); - IRegionModule godsModule = new GodsModule(); - godsModule.Initialise(testScene, new IniConfigSource()); - testScene.AddModule(godsModule.Name, godsModule); + INonSharedRegionModule godsModule = new GodsModule(); + godsModule.Initialise(new IniConfigSource()); + godsModule.AddRegion(testScene); // Add scene to services m_assetService.AddRegion(testScene); @@ -350,6 +350,10 @@ namespace OpenSim.Tests.Common /// /// /// If called directly, then all the modules must be shared modules. + /// + /// We are emulating here the normal calls made to setup region modules + /// (Initialise(), PostInitialise(), AddRegion, RegionLoaded()). + /// TODO: Need to reuse normal runtime module code. /// /// /// @@ -359,28 +363,10 @@ namespace OpenSim.Tests.Common List newModules = new List(); foreach (object module in modules) { -// Console.WriteLine("MODULE RAW {0}", module); - if (module is IRegionModule) - { - IRegionModule m = (IRegionModule)module; - - foreach (Scene scene in scenes) - { - m.Initialise(scene, config); - scene.AddModule(m.Name, m); - } - - m.PostInitialise(); - } - else if (module is IRegionModuleBase) - { - // for the new system, everything has to be initialised first, - // shared modules have to be post-initialised, then all get an AddRegion with the scene - IRegionModuleBase m = (IRegionModuleBase)module; -// Console.WriteLine("MODULE {0}", m.Name); - m.Initialise(config); - newModules.Add(m); - } + IRegionModuleBase m = (IRegionModuleBase)module; +// Console.WriteLine("MODULE {0}", m.Name); + m.Initialise(config); + newModules.Add(m); } foreach (IRegionModuleBase module in newModules) @@ -396,7 +382,7 @@ namespace OpenSim.Tests.Common scene.AddRegionModule(module.Name, module); } } - + // RegionLoaded is fired after all modules have been appropriately added to all scenes foreach (IRegionModuleBase module in newModules) foreach (Scene scene in scenes) @@ -709,4 +695,4 @@ namespace OpenSim.Tests.Common return sog; } } -} \ No newline at end of file +} diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index eea68c3b40..d4b564869b 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -41,9 +41,9 @@ namespace OpenSim.Tests.Common.Mock public TestScene( RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, - ModuleLoader moduleLoader, bool dumpAssetsToFile, + bool dumpAssetsToFile, IConfigSource config, string simulatorVersion) - : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader, + : base(regInfo, authen, sceneGridService, simDataService, estateDataService, dumpAssetsToFile, config, simulatorVersion) { } @@ -73,4 +73,4 @@ namespace OpenSim.Tests.Common.Mock get { return m_asyncSceneObjectDeleter; } } } -} \ No newline at end of file +} diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index fa284bdef1..ed1b9693fd 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -57,9 +57,6 @@ ; ## CLIENTS ; ## - ; Enables EventQueueGet Service. - EventQueue = true - ; Set this to the DLL containing the client stack to use. clientstack_plugin="OpenSim.Region.ClientStack.LindenUDP.dll" @@ -1421,16 +1418,6 @@ ; DeleteScriptsOnStartup = false -[OpenGridProtocol] - ;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know.. - ;On/true or Off/false - ogp_enabled=false - - ;Name Prefix/suffix when using OGP - ogp_firstname_prefix="" - ogp_lastname_suffix="_EXTERNAL" - - [Concierge] ; Enable concierge module ; Default is false