Convert the prim count module into a permissionsmodule
parent
f644c0346b
commit
9daad86717
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Collections.Generic;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
@ -50,27 +51,27 @@ namespace OpenSim.Region.OptionalModules
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private bool m_enabled;
|
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 Type ReplaceableInterface { get { return null; } }
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig moduleConfig = source.Configs["PrimLimitsModule"];
|
IConfig myConfig = config.Configs["Startup"];
|
||||||
if (moduleConfig != null)
|
|
||||||
{
|
string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule");
|
||||||
this.m_enabled = moduleConfig.GetBoolean("EnforcePrimLimits", false);
|
|
||||||
}
|
List<string> modules=new List<string>(permissionModules.Split(','));
|
||||||
else
|
|
||||||
{
|
if(!modules.Contains("PrimLimitsModule"))
|
||||||
this.m_enabled = false;
|
return;
|
||||||
}
|
|
||||||
m_log.DebugFormat("[PRIM LIMITS]: INITIALIZED MODULE");
|
m_log.DebugFormat("[PRIM LIMITS]: Initialized module");
|
||||||
|
m_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[PRIM LIMITS]: CLOSED MODULE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
|
@ -82,7 +83,7 @@ namespace OpenSim.Region.OptionalModules
|
||||||
scene.Permissions.OnRezObject += CanRezObject;
|
scene.Permissions.OnRezObject += CanRezObject;
|
||||||
scene.Permissions.OnObjectEntry += CanObjectEnter;
|
scene.Permissions.OnObjectEntry += CanObjectEnter;
|
||||||
scene.Permissions.OnDuplicateObject += CanDuplicateObject;
|
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)
|
public void RemoveRegion(Scene scene)
|
||||||
|
@ -94,14 +95,13 @@ namespace OpenSim.Region.OptionalModules
|
||||||
scene.Permissions.OnRezObject -= CanRezObject;
|
scene.Permissions.OnRezObject -= CanRezObject;
|
||||||
scene.Permissions.OnObjectEntry -= CanObjectEnter;
|
scene.Permissions.OnObjectEntry -= CanObjectEnter;
|
||||||
scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
|
scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
|
||||||
m_log.DebugFormat("[PRIM LIMITS]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||||
m_log.DebugFormat("[PRIM LIMITS]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
|
private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
|
||||||
{
|
{
|
||||||
// This may be a little long winded and can probably be optomized
|
// This may be a little long winded and can probably be optomized
|
||||||
|
@ -170,4 +170,4 @@ namespace OpenSim.Region.OptionalModules
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue