provide config option for media on a prim

prebuild-update
Justin Clark-Casey (justincc) 2010-07-26 21:41:39 +01:00
parent 412fed975f
commit 4d23749241
3 changed files with 26 additions and 4 deletions

View File

@ -60,6 +60,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public string Name { get { return "MoapModule"; } } public string Name { get { return "MoapModule"; } }
public Type ReplaceableInterface { get { return null; } } public Type ReplaceableInterface { get { return null; } }
/// <summary>
/// Is this module enabled?
/// </summary>
protected bool m_isEnabled = true;
/// <summary> /// <summary>
/// The scene to which this module is attached /// The scene to which this module is attached
/// </summary> /// </summary>
@ -85,13 +90,19 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// </summary> /// </summary>
protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>(); protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>();
public void Initialise(IConfigSource config) public void Initialise(IConfigSource configSource)
{ {
// TODO: Add config switches to enable/disable this module IConfig config = configSource.Configs["MediaOnAPrim"];
if (config != null && !config.GetBoolean("Enabled", false))
m_isEnabled = false;
} }
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (!m_isEnabled)
return;
m_scene = scene; m_scene = scene;
m_scene.RegisterModuleInterface<IMoapModule>(this); m_scene.RegisterModuleInterface<IMoapModule>(this);
} }
@ -100,6 +111,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
if (!m_isEnabled)
return;
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps; m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps;
m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded; m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded;
@ -108,6 +122,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void Close() public void Close()
{ {
if (!m_isEnabled)
return;
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded; m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded;

View File

@ -401,8 +401,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
// This log line will be commented out when no longer required for debugging // This log line will be commented out when no longer required for debugging
if (m_moapModule == null) // if (m_moapModule == null)
m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); // m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
} }
public void Close() public void Close()

View File

@ -1245,6 +1245,11 @@
; enabled=false ; enabled=false
[MediaOnAPrim]
; Enable media on a prim facilities
Enabled = true;
;; ;;
;; These are defaults that are overwritten below in [Architecture]. ;; These are defaults that are overwritten below in [Architecture].
;; These defaults allow OpenSim to work out of the box with ;; These defaults allow OpenSim to work out of the box with