From c60e1a1ae6b3d4481ba7f663190576647343473f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 13:49:07 -0800 Subject: [PATCH 01/16] J2KDecoderModule: move the code out of PostInitialise() --- .../Agent/TextureSender/J2KDecoderModule.cs | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 2879154ba6..a54fec7665 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -55,6 +55,16 @@ 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; @@ -98,7 +108,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender public void PostInitialise() { - m_cache = m_scene.RequestModuleInterface(); } public void Close() @@ -297,7 +306,7 @@ 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(); @@ -321,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender #endregion Serialize Layer Data - m_cache.Cache(layerDecodeAsset); + Cache.Cache(layerDecodeAsset); } } @@ -331,10 +340,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) { @@ -346,7 +355,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; } @@ -367,7 +376,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; } @@ -378,7 +387,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; } } From 23605cf93d110523320430d1c9dd2e83865fca01 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 11 Nov 2012 20:41:20 +0000 Subject: [PATCH 02/16] converting NPC module to ISharedRegionModule Signed-off-by: Diva Canto --- .../OptionalModules/World/NPC/NPCModule.cs | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3f25bcf58e..b372c88d8a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -31,6 +31,7 @@ using System.Reflection; using System.Threading; using log4net; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -40,26 +41,41 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.OptionalModules.World.NPC { - public class NPCModule : IRegionModule, INPCModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class NPCModule : INPCModule, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 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,10 +85,7 @@ 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) { From f560d581bbeb420dccdfa80c574724deada8038b Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 11 Nov 2012 20:42:55 +0000 Subject: [PATCH 03/16] document & 80-character width terminal formatting Signed-off-by: Diva Canto --- .../Region/Framework/Interfaces/INPCModule.cs | 114 +++++++++++----- .../OptionalModules/World/NPC/NPCModule.cs | 129 +++++++++++------- 2 files changed, 158 insertions(+), 85 deletions(-) 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/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index b372c88d8a..41e70970cb 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -29,14 +29,16 @@ 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 @@ -44,9 +46,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 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 bool Enabled { get; private set; } @@ -89,8 +93,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC 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; @@ -99,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) @@ -112,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; @@ -147,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) { @@ -192,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; } } @@ -270,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; } } @@ -281,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) { @@ -356,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; } @@ -389,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; } } } From 84be90e5f83835800443dde3473545ad73c62a9b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 14:00:58 -0800 Subject: [PATCH 04/16] One more module converted: EmailModule. --- .../Scripting/EMailModules/EmailModule.cs | 110 ++++++++++-------- 1 file changed, 64 insertions(+), 46 deletions(-) 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) From 963b1e861c710337b23276680ddfb68ec2ceaadf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 14:22:06 -0800 Subject: [PATCH 05/16] One more module converted: ScriptsHttpRequests. --- .../HttpRequest/ScriptsHttpRequests.cs | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) 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 From 6759ed1013b78371b28c2d802c5d793e7b32c723 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 14:46:22 -0800 Subject: [PATCH 06/16] One more module converted: LoadImageURLModule. Also removed it from its hard-coded instantiation (I think I understood what the problem was, and that I've done it right). --- .../LoadRegions/LoadRegionsPlugin.cs | 4 +- .../LoadImageURL/LoadImageURLModule.cs | 57 ++++++++++++------- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 00657028e4..e7b12bee0e 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -101,8 +101,8 @@ namespace OpenSim.ApplicationPlugins.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]: 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..."); diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 45e652788a..a08a183784 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -37,16 +37,33 @@ 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); private string m_name = "LoadImageURL"; private Scene m_scene; private IDynamicTextureManager m_textureManager; + private IDynamicTextureManager TextureManager + { + get + { + if (m_textureManager == null && m_scene != null) + { + m_textureManager = m_scene.RequestModuleInterface(); + if (m_textureManager != null) + { + m_textureManager.RegisterRender(GetContentType(), this); + } + } + return m_textureManager; + } + } private string m_proxyurl = ""; private string m_proxyexcepts = ""; @@ -104,29 +121,31 @@ 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) - { - m_textureManager = m_scene.RequestModuleInterface(); - if (m_textureManager != null) - { - m_textureManager.RegisterRender(GetContentType(), this); - } - } + } + + public void AddRegion(Scene scene) + { + if (m_scene == null) + m_scene = scene; + + } + + public void RemoveRegion(Scene scene) + { + } + + public void RegionLoaded(Scene scene) + { } public void Close() @@ -138,9 +157,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL get { return m_name; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion @@ -252,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", imageJ2000.Length, state.RequestID); - m_textureManager.ReturnData( + TextureManager.ReturnData( state.RequestID, new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( request.RequestUri, null, imageJ2000, newSize, false)); From 9f45198516ef7c7bfc92d638ae142d821852a4d9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 14:54:40 -0800 Subject: [PATCH 07/16] One more module: DynamicTextureModule. Removed it from the special load in the beginning. --- .../LoadRegions/LoadRegionsPlugin.cs | 4 +- .../DynamicTexture/DynamicTextureModule.cs | 40 +++++++++++++------ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index e7b12bee0e..920a6bcca5 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -99,8 +99,8 @@ 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]: 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..."); diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 93a045eff7..9d905174f9 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); @@ -323,17 +325,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 +356,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 +375,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture get { return "DynamicTextureModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion From 4de8915dddf7fdf6456b471c303b4d214ad1bb8e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 15:04:02 -0800 Subject: [PATCH 08/16] One more module converted: VectorRenderModule. --- .../VectorRender/VectorRenderModule.cs | 68 +++++++++++-------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index b4e3d775c5..efa99e9648 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,22 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender private Scene m_scene; private IDynamicTextureManager m_textureManager; + private IDynamicTextureManager TextureManager + { + get + { + if (m_textureManager == null && m_scene != null) + { + m_textureManager = m_scene.RequestModuleInterface(); + if (m_textureManager != null) + { + m_textureManager.RegisterRender(GetContentType(), this); + } + } + return m_textureManager; + } + } + private Graphics m_graph; private string m_fontName = "Arial"; @@ -104,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender public bool AsyncConvertData(UUID id, string bodyData, string extraParams) { // XXX: This isn't actually being done asynchronously! - m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); + TextureManager.ReturnData(id, ConvertData(bodyData, extraParams)); return true; } @@ -131,45 +149,41 @@ 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) + { + } - // 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 +195,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender get { return "VectorRenderModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion From 571f6a030002e754e9c711218396fa649ac28de6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 15:29:25 -0800 Subject: [PATCH 09/16] One more module converted: XMLRPCModule. Removed it from the special loading at start. --- .../LoadRegions/LoadRegionsPlugin.cs | 4 +- .../Scripting/XMLRPC/XMLRPCModule.cs | 82 ++++++++++++------- 2 files changed, 53 insertions(+), 33 deletions(-) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 920a6bcca5..a8a3237389 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -103,8 +103,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions //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]: 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/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 From ba2318bd6143fb465ca641647d44a3c6e1ffc8c1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 15:59:09 -0800 Subject: [PATCH 10/16] One more module converted: PermissionsModule. --- .../World/Permissions/PermissionsModule.cs | 305 ++++++++++-------- 1 file changed, 174 insertions(+), 131 deletions(-) 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) From abef034d1b4f3553384b43b33da2b6993d6437b6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 16:10:47 -0800 Subject: [PATCH 11/16] One more module converted: IRCStackModule. --- .../InternetRelayClientView/IRCStackModule.cs | 74 +++++++++++-------- 1 file changed, 45 insertions(+), 29 deletions(-) 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 } } From 4e8c8b2cd8954ca2ce87d642e4c106c904ec2295 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 16:18:47 -0800 Subject: [PATCH 12/16] One more module converted: MRMModule. --- .../Scripting/Minimodule/MRMModule.cs | 95 +++++++++++-------- 1 file changed, 58 insertions(+), 37 deletions(-) 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 /// From 64fad2f80e1bf7a73b7e92adf4462e1b6f9aa335 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 16:44:59 -0800 Subject: [PATCH 13/16] Two more modules converted: XmlRpcGridRouterModule and XmlRpcRouterModule. --- .../XmlRpcGridRouterModule.cs | 36 ++++++++++++---- .../XmlRpcRouterModule/XmlRpcRouterModule.cs | 42 ++++++++++++++----- 2 files changed, 60 insertions(+), 18 deletions(-) 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}); From 113a9704f286077c64c2f51c59503b64bf681734 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 17:02:22 -0800 Subject: [PATCH 14/16] One more module converted: WebStatsModule. --- .../Region/UserStatistics/WebStatsModule.cs | 169 ++++++++++-------- 1 file changed, 93 insertions(+), 76 deletions(-) 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) { From db418bff2bb6b2676c996e77b260b0977e886f5d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 19:39:21 -0800 Subject: [PATCH 15/16] Fix issues with the DynamicTextureModule and corresponding unit tests. --- .../DynamicTexture/DynamicTextureModule.cs | 10 ++++++ .../LoadImageURL/LoadImageURLModule.cs | 31 +++++++++---------- .../VectorRender/VectorRenderModule.cs | 30 +++++++++--------- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 10 +++--- 4 files changed, 44 insertions(+), 37 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 9d905174f9..9d77b19f7f 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -83,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) diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index a08a183784..65737fa693 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -49,21 +49,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL private string m_name = "LoadImageURL"; private Scene m_scene; private IDynamicTextureManager m_textureManager; - private IDynamicTextureManager TextureManager - { - get - { - if (m_textureManager == null && m_scene != null) - { - m_textureManager = m_scene.RequestModuleInterface(); - if (m_textureManager != null) - { - m_textureManager.RegisterRender(GetContentType(), this); - } - } - return m_textureManager; - } - } private string m_proxyurl = ""; private string m_proxyexcepts = ""; @@ -146,6 +131,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL 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); + } + } } public void Close() @@ -191,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; @@ -271,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", imageJ2000.Length, state.RequestID); - TextureManager.ReturnData( + m_textureManager.ReturnData( state.RequestID, new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( request.RequestUri, null, imageJ2000, newSize, false)); diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index efa99e9648..689e8a7970 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -58,21 +58,6 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender private Scene m_scene; private IDynamicTextureManager m_textureManager; - private IDynamicTextureManager TextureManager - { - get - { - if (m_textureManager == null && m_scene != null) - { - m_textureManager = m_scene.RequestModuleInterface(); - if (m_textureManager != null) - { - m_textureManager.RegisterRender(GetContentType(), this); - } - } - return m_textureManager; - } - } private Graphics m_graph; private string m_fontName = "Arial"; @@ -121,8 +106,13 @@ 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! - TextureManager.ReturnData(id, ConvertData(bodyData, extraParams)); + m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); return true; } @@ -180,6 +170,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender 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); + } + } } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index f9c1ac2656..db0a7fc3b9 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -383,6 +383,11 @@ namespace OpenSim.Tests.Common } } + foreach (IRegionModuleBase module in newModules) + { + if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise(); + } + foreach (IRegionModuleBase module in newModules) { foreach (Scene scene in scenes) @@ -392,11 +397,6 @@ namespace OpenSim.Tests.Common } } - foreach (IRegionModuleBase module in newModules) - { - if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise(); - } - // RegionLoaded is fired after all modules have been appropriately added to all scenes foreach (IRegionModuleBase module in newModules) foreach (Scene scene in scenes) From 152d5dc2a7c9c9e304654fcbea47f8c126d7e727 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 21:13:14 -0800 Subject: [PATCH 16/16] Fix mantis #6425 --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8b34c286fc..d112a90709 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -180,12 +180,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;