From 9daad867174e0ab0ddec707697b83b37c9208777 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 9 May 2011 02:47:40 +0200 Subject: Convert the prim count module into a permissionsmodule --- .../PrimLimitsModule/PrimLimitsModule.cs | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 5bafec3..471b90f 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs @@ -27,6 +27,7 @@ using System; using System.Reflection; +using System.Collections.Generic; using log4net; using Mono.Addins; using Nini.Config; @@ -50,27 +51,27 @@ namespace OpenSim.Region.OptionalModules private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private bool m_enabled; - public string Name { get { return "Prim Limits Module"; } } + public string Name { get { return "PrimLimitsModule"; } } public Type ReplaceableInterface { get { return null; } } - public void Initialise(IConfigSource source) + public void Initialise(IConfigSource config) { - IConfig moduleConfig = source.Configs["PrimLimitsModule"]; - if (moduleConfig != null) - { - this.m_enabled = moduleConfig.GetBoolean("EnforcePrimLimits", false); - } - else - { - this.m_enabled = false; - } - m_log.DebugFormat("[PRIM LIMITS]: INITIALIZED MODULE"); + IConfig myConfig = config.Configs["Startup"]; + + string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); + + List modules=new List(permissionModules.Split(',')); + + if(!modules.Contains("PrimLimitsModule")) + return; + + m_log.DebugFormat("[PRIM LIMITS]: Initialized module"); + m_enabled = true; } public void Close() { - m_log.DebugFormat("[PRIM LIMITS]: CLOSED MODULE"); } public void AddRegion(Scene scene) @@ -82,7 +83,7 @@ namespace OpenSim.Region.OptionalModules scene.Permissions.OnRezObject += CanRezObject; scene.Permissions.OnObjectEntry += CanObjectEnter; scene.Permissions.OnDuplicateObject += CanDuplicateObject; - m_log.DebugFormat("[PRIM LIMITS]: REGION {0} ADDED", scene.RegionInfo.RegionName); + m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); } public void RemoveRegion(Scene scene) @@ -94,14 +95,13 @@ namespace OpenSim.Region.OptionalModules scene.Permissions.OnRezObject -= CanRezObject; scene.Permissions.OnObjectEntry -= CanObjectEnter; scene.Permissions.OnDuplicateObject -= CanDuplicateObject; - m_log.DebugFormat("[PRIM LIMITS]: REGION {0} REMOVED", scene.RegionInfo.RegionName); } public void RegionLoaded(Scene scene) { m_dialogModule = scene.RequestModuleInterface(); - m_log.DebugFormat("[PRIM LIMITS]: REGION {0} LOADED", scene.RegionInfo.RegionName); } + private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) { // This may be a little long winded and can probably be optomized @@ -170,4 +170,4 @@ namespace OpenSim.Region.OptionalModules return true; } } -} \ No newline at end of file +} -- cgit v1.1